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

Order methods and variables on functional components #2574

Open
lucasflomuller opened this issue Feb 18, 2020 · 1 comment
Open

Order methods and variables on functional components #2574

lucasflomuller opened this issue Feb 18, 2020 · 1 comment

Comments

@lucasflomuller
Copy link

lucasflomuller commented Feb 18, 2020

Kind of like sort-comp #2408 but for functional components, an order could be something like

  1. useContext
  2. useState
  3. useReducer
  4. useSelector
  5. useDispatch
  6. ...
  7. customHooks
  8. useEffect
  9. useLayoutEffect
  10. ...
  11. useCallback
  12. ...
  13. useMemo
  14. return
@ljharb
Copy link
Member

ljharb commented Feb 18, 2020

SFCs aren't declarative the way classes are - i don't think it makes sense to apply sorting rules to imperative code.

If you want that kind of structure, I think a class component is the ideal choice.

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

No branches or pull requests

2 participants