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

Transition to functional React components #1543

Open
emlys opened this issue Mar 25, 2024 · 1 comment
Open

Transition to functional React components #1543

emlys opened this issue Mar 25, 2024 · 1 comment
Labels
good first issue Good for newcomers task Something needs to be done workbench For issues relating to the workbench front-end of invest

Comments

@emlys
Copy link
Member

emlys commented Mar 25, 2024

When we began developing the workbench, class components were the standard and functional components were new. React has moved away from class components, and functional components are the standard. I haven't seen any indication that class components will be deprecated any time soon, but there are some reasons it would make sense to convert our code to use functional components:

  • Documentation about class components has been moved to a legacy site and is no longer updated
  • It's increasingly hard to find tutorials and code examples using class components
  • i18next is easier to use with functional components; exported class components require a workaround
  • We often use the pattern of passing component functions as props to other components. eslint warns against this, and the recommended solution uses the functional component style.
  • We have written our newer components using the functional style, and found it to work well and require less boilerplate code
  • When working on code that uses both styles of components, I find it confusing having to switch back and forth
@emlys emlys added good first issue Good for newcomers task Something needs to be done labels Mar 25, 2024
@davemfish davemfish added the workbench For issues relating to the workbench front-end of invest label Mar 25, 2024
@R-Stev
Copy link

R-Stev commented Mar 26, 2024

I should be able to adjust the class components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers task Something needs to be done workbench For issues relating to the workbench front-end of invest
Projects
None yet
Development

No branches or pull requests

3 participants