description |
---|
Here are some of the recommendations to achieve optimal code quality and to follow best practices. |
- Data Fetching
- Prefer inferred types over explicit ones
- Prefer early returns
- Avoid comparing multiple values with
includes
- Validate using zod instead of type casting
- Don't hesitate extracting nested code into new React Components
- Code organization tips
- Consider state machines over simple boolean states
- Don't extract function props outside render just because
- Make proper user of React Children
- Authed CRUDs should be user centric
- Prefer adding tRPC queries over
/api/..
endpoints onweb
- Prefer
defaultHandler
for simple API handlers - Prefer Composition over Prop Drilling
- Avoid Prop Drilling
- prefer-ternaries-over-short-circuiting-and-and-for-react-components.md
{% hint style="info" %} TODO: Expand each of these bullet points {% endhint %}