-
Notifications
You must be signed in to change notification settings - Fork 25
Best Practices tips for Frontend Coding
veeramarni edited this page Jun 12, 2021
·
9 revisions
-
Synchronous Code only: Don't write any asynchronous code (avoid promises, await) directly in the UI. Use libraries such as React Query to better manage the asynchronous code.
-
No Expansive code: Don't write expensive code with
react
components that would take full stateIf you ever need to take a full state either from
redux
orapollo-client
and further computed within the component would result in bad performance.-
If the
state
has nested objects which cause the props to more prone to changes causing unwanted Component rendering. -
this code won't be reusable.
So in that case, use selectors and inject them into props so it resolves the above-mentioned issues.
-