How to Learn React in 2024
I saw a post on reddit today about a backend engineer wanting to learn React and of course the first comment assumes a backend engineer knows what package.json
is.
So here’s what I would tell someone if I needed them to work on a React project. If I ever need to hire someone to work on my project, I would need them to be able to fix React code and write tests for it, because that’s pretty hard.
- Install the NodeJS LTS via
nvm
ornvm-windows
Install nodeJS via nvm or nvm-windowsnvm: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
nvm-windows: nvm-setup.exe - Enable yarn (
corepack enable
) yarn create vite
→ React + Typescript- Learn React (UI + Logic).
- Remember to learn CSS so you can customize libraries. People will recommend tailwind, but I digress. I’ve seen what people have written with tailwind and it’s atrocious (unreadable). Styles should rarely change, and so shouldn’t pollute the component.
- Once you know what Contexts are and when to use them, focus on some web-specific tech. One thing missing from most web tutorials and templates is a baked in service-worker.js and manifest to quickly deploy a progressive web app. Such a shame really. PWA basically allow you to ship to mobile without having to learn expo and dealing with App Store or Google Play Store policies.
- Think about deployment. SPA (no backend) -> GitHub Pages. SPA (+backed) (e.g. DigitalOcean App Platform).
- Write like one or two tests using jest or cypress
Sorry if this isn’t completely finished, I got carried away with something else in the middle of writing this.