Skip to content

Fix Lab SCA1 scaffold details that no longer match the SPFx generator - #1003

Open
Elliot Margot (OwnOptic) wants to merge 1 commit into
microsoft:mainfrom
OwnOptic:docs/sca1-react-18-scaffold
Open

Fix Lab SCA1 scaffold details that no longer match the SPFx generator#1003
Elliot Margot (OwnOptic) wants to merge 1 commit into
microsoft:mainfrom
OwnOptic:docs/sca1-react-18-scaffold

Conversation

@OwnOptic

Copy link
Copy Markdown
Contributor

Lab SCA1 tells you to scaffold with yo @microsoft/sharepoint@next. Three details in the lab describe output that tag no longer produces, checked against @microsoft/generator-sharepoint@1.24.0-beta.3.

React 17 -> React 18. The Exercise 2 note says the React template wires up React 17. The generator's copilotComponentReact dependency group pins react and react-dom at 18.3.1 and @types/react at 18.2.79.

The render() snippet in Exercise 3 is a React 17 mount. The scaffolded component imports createRoot from react-dom/client, keeps the root on the class so onTeardown() can unmount it, and passes onRequestDisplayMode and onRequestSizeChange down to the React component. The snippet showed ReactDOM.render(...) and neither callback, so it did not match the file the reader has just been told to open. Replaced with the scaffolded code, and the sentence above it now mentions the callbacks and the root.

IHelloWorldLabProps in Exercise 4 does not exist. The generator emits I<componentName>Props, so with the lab's component name it is IHelloWorldProps. The snippet as written does not compile.

Verified by running npm pack @microsoft/generator-sharepoint@next and reading lib/common/dependencies.json and lib/templates/copilotComponent/react/. Docs only, one file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant