I’ve recently used the create-react-app package a couple of times and I’m into it! The
create-react-app package is an officially supported way to create an app with “a modern build setup with no configuration.”
No configuration? Not really … from the user’s perspective, sure, but the configuration is just behind the scenes.
Ever thought about doing something with React and then cried for days because you didn’t want to deal with starting a new Webpack config? Nah, I haven’t, I could understand if you did though. It can be super daunting!
What’s cool about it?
It actually works! It takes longer than I’d expect, but I’m happy to start a React app this way.
What do you get?
The directory structure looks like this:
I love how un-intimidating your package.json is at the end – the legwork is being done by react-scripts, and you have three commands available in your
scripts: start, build, and eject.
Start runs your app locally with hot module reloading. And you didn’t have to suffer a configuration! Awesome! This is great!
Build builds your app for production. Running this and uploading the output to the interwebz (ex. S3) totally works! Awesome!
Eject … sounds scary. It’s a one-way operation to expose those config internals to you so you can fuss with them yourself.
Offline mode, please!
I thought about writing this post because I wanted to give this feedback. Boy oh boy would it be nice to have an
—-offline mode so I could just get started, and run my
npm install once I reconnected to the network. Does anyone else want this use case, or just me?
Eject is so scary!
Why is eject so scary? I’m not really sure. I ran it to check it out and it’s not so bad. However, when you do, it does give you a survey to ask for feedback why you rejected, which is really awesome!
All that happens though is your package.json grows quite a bit as you see all those packages hidden by
react-scripts, so you now have control over your configuration as you like:
Really awesome! I’m glad this exists and I think I’ll be able to get along a while without having to eject 🙂