Skip to content

Instantly share code, notes, and snippets.

@jdjuan
Last active April 3, 2023 16:02
Show Gist options
  • Save jdjuan/ded37499f013d11830f20fc980ac2a07 to your computer and use it in GitHub Desktop.
Save jdjuan/ded37499f013d11830f20fc980ac2a07 to your computer and use it in GitHub Desktop.
React Setup

React Lessons

  • Use Recoil for state management early on. It's too simple not to do it
  • Falsy values still render in in-line conditions. Always !! expressions that might not be boolean
  • Use default values for Enums, or ordering will change values
  • With event handlers, make sure to use an arrow function to avoid having to use .bind
  • If you want a component not to render, return null
  • Create interfaces first for the backend and the frontend
  • Define components (p, h1,h2,h3,h4) and mark them in the designs (with variants)
  • Put links in a common place
  • Don’t give values to enums that could change, rather keep them as numbers (default)
  • Comment long html forms
  • Prefer duplication over the wrong abstraction. And then see if you can abstract.
    • Never start duplication until the first instance is fully ready
  • Organize folders ahead on, and don’t miss enums and interfaces, and options, and mappers
  • If using Tailwind, then don't create components for inputs, buttons, and links. Instead use utilites

Dependencies

  1. classnames
  2. tsconfig: "baseUrl": "src",
  3. swr + axios
  4. tailwindcss
  5. https://github.com/tailwindlabs/prettier-plugin-tailwindcss
  6. https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss
  7. https://marketplace.visualstudio.com/items?itemName=austenc.tailwind-docs
  8. https://marketplace.visualstudio.com/items?itemName=SimonSiefke.svg-preview
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment