Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update class components to functional components #104

Closed
wjlee2020 opened this issue Sep 2, 2023 · 3 comments · Fixed by #106
Closed

Update class components to functional components #104

wjlee2020 opened this issue Sep 2, 2023 · 3 comments · Fixed by #106
Assignees
Labels
Type: sample request Request for a sample

Comments

@wjlee2020
Copy link

Although the React version is 17~, the current template uses class-components.
I think it may help to update the template to use functional class components and hooks, especially for new-comers to office add-ins and react post-class components.

I would be willing to open a PR for this update.

@AlexJerabek
Copy link

Thanks for flagging this issue. Coincidentally, @Rick-Kirkham is currently working to update our React templates to use contemporary React patterns. It would be excellent if you could provide feedback on that PR when it's ready.

@Rick-Kirkham
Copy link
Contributor

@wjlee2020 Thanks for your interest. As @AlexJerabek mentioned, we agree. I have created new projects for the 6 hosts (Excel, PPT, Outlook, Project, OneNote, and Word) that use functional components and hooks. They also use the newest version of Fluent UI.

There are some other improvements, too; e.g., the existing templates have the Office.js code inside the same module as the App component, which is not consistent with the principle of separation-of-concerns. Also, the existing templates assign data that will never change to state, which doesn't really illustrate state management. So, our existing React projects aren't very "Reacty".

The next major step is to update the unit tests and end-to-end tests in this repo (and the React Typescript) repo to match the new projects. I'm working on that now.

@Rick-Kirkham Rick-Kirkham added the Type: sample request Request for a sample label Sep 5, 2023
@wjlee2020
Copy link
Author

Sounds great! Thanks for the updates. Looking forward to the changes/PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: sample request Request for a sample
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants