Setting Up React the Simple Way (Yes, Really)
Setting up React used to feel like building IKEA furniture with missing instructions and extra screws. I remember staring at my terminal, wondering if I had just summoned a demon or installed a dev server. But here’s the good news: it’s not 2016 anymore. The React ecosystem has grown up, and spinning up a project today is actually… kind of nice. Whether you’re using Create React App (CRA) or the much faster Vite, getting started doesn’t have to be painful. In fact, it can be fast, clean, and dare I say—fun? Let me show you how I do it without losing my mind.
Forget the Fear: React Setup Isn’t Rocket Science
I used to dread setting up React. There was always some Webpack config gremlin waiting to bite. Now? It’s basically a one-liner. You type something like npm create vite@latest my-app -- --template react
, and you’ve got a functioning React app before your coffee even cools.
And yeah, there are still ways to make it complicated if you're into that, but trust me—you don’t need to. Keep it simple. Focus on building, not configuring.
CRA vs. Vite: Which One Won My Heart (and Time)?
Create React App was my go-to for years. It was the safe, boring choice. But Vite? Vite is like CRA’s cooler, faster cousin who shows up with TypeScript support and doesn’t waste time.
Once I switched, I couldn’t go back. Vite’s dev server is blazing fast, and it just feels lighter. Plus, the build times? Chef’s kiss.
That said, CRA still works fine if you're working on older tutorials or company codebases. But if you're starting from scratch today? Try Vite. You’ll thank yourself later.
Let’s Spin Up a React App Together (Step-by-Step)
Okay, real talk. Here’s how I spin up a React project in under 60 seconds:
1. Open terminal. 2. Run:
npm create vite@latest my-app -- --template react
3. cd my-app
4. npm install
5. npm run dev
Boom. You’ve got hot module reloading, JSX, and modern tooling—all without crying into a stack overflow thread.
Bonus tip: name your project something better than my-app
. Future-you will appreciate it.
My Dev Environment: VS Code, Extensions, Sanity
If you’re not using VS Code, that’s cool. But I am—and I’ve tuned it for React like a guitar before a gig.
Must-have extensions:
ESLint (catch dumb mistakes before they ruin your day) Prettier (formatting wars? Prettier wins) React Developer Tools Tailwind IntelliSense if you're using Tailwind (which I do often)
I also crank up the font size and dark mode because—eyes. And don’t forget to enable autosave. You will forget to save, and it will bite you.
Sneaky Gotchas: npm vs yarn, and Why It Matters
I once switched package managers mid-project. You’d think that wouldn’t be a big deal. It was. Half my dependencies broke and the lockfile basically cried itself to sleep.
Pick one—npm or yarn—and stick with it per project. Mixing them leads to weird bugs, missing modules, and existential dread.
Personally, I use npm
these days because it’s improved a ton. But if your team swears by yarn
, that’s fine too. Just be consistent.
What to Do When It Just. Won’t. Work.
Let me say this loud for the folks in the back: React setup sometimes breaks. Even with the cleanest tooling.
If your dev server won’t start or your dependencies won’t install, don’t panic. Delete the node_modules
folder and the package-lock.json
file (or yarn.lock
), then reinstall:
rm -rf node_modules
rm package-lock.json
npm install
This fixes like 90% of weird errors. If that doesn’t work? Google the exact error message—stack traces are your new best friend. And yes, Stack Overflow still has the answers (even if they’re buried under passive-aggressive comments).
Next up, let’s actually write some React. It’s time for Your First React Component (aka Hello Component World). Here’s the next lesson.