News for hackers. Stuff that matters.
Re:Create React App 2.0: Babel 7, Sass, and More by magicbuzz on Monday October 01, 2018 @10:26PM (#18118387)
Is it possible to use Redux without an eject?
Re:Create React App 2.0: Babel 7, Sass, and More by acemarke on Monday October 01, 2018 @10:45PM (#18118464)
Absolutely - all you've ever needed to do is `npm i redux react-redux`, then add them to the app. They're just libraries, no special behavior needed.

See the "Configuring Your Store" docs page [0] for copy-pasteable examples of adding Redux to a React project.

Also, we're working on a `redux-starter-kit` project [1] that will soon become an official Redux-branded tool to help with common pain points, like setting up the store properly, simplifying immutable reducer update logic, and more. I talked about it in my React Boston "State of Redux" presentation [2] over the weekend. Please try it out, and let us know how it works and what else we should add!

[0] https://redux.js.org/recipes/configuringyourstore

[1] https://github.com/markerikson/redux-starter-kit

[2] https://blog.isquaredsoftware.com/2018/10/presentation-state...

Re:Create React App 2.0: Babel 7, Sass, and More by danabramov on Monday October 01, 2018 @11:03PM (#18118519)
You can add any JavaScript library without ejecting. Unless it demands changes to your build process.
Re:Create React App 2.0: Babel 7, Sass, and More by daok on Monday October 01, 2018 @10:29PM (#18118395)
It always been...
Re:Create React App 2.0: Babel 7, Sass, and More by magicbuzz on Monday October 01, 2018 @10:34PM (#18118416)
and redux-saga?
Re:Create React App 2.0: Babel 7, Sass, and More by seankimdesign on Monday October 01, 2018 @10:42PM (#18118454)
Of course redux-saga can be used. Unless your goal is to rewire the project compilation step, ejecting is rarely required.
Re:Create React App 2.0: Babel 7, Sass, and More by Waterluvian on Tuesday October 02, 2018 @12:37AM (#18118833)
Forgive me. What is "eject"?
Re:Create React App 2.0: Babel 7, Sass, and More by acemarke on Tuesday October 02, 2018 @01:26AM (#18119027)
The Create-React-App tool hides all of the Babel and Webpack configuration by default. The only dependency you have in your app is the `react-scripts` package.

This drastically simplifies things for your app, and means you can get the latest build system updates with a single update command whenever a new version of `react-scripts` comes out. However, it also means that if you _do_ need to modify the configuration in some way, it's normally inaccessible.

CRA includes a one-time `npm run eject` command that copies over all of the actual dependencies and config files into your project. "Ejecting" means you're taking ownership of those config files, and also means you lose the ability to easily upgrade with a single command.

Re:Create React App 2.0: Babel 7, Sass, and More by Raed667 on Tuesday October 02, 2018 @03:14AM (#18119404)
You can even change some webpack configs without ejecting using react-app-rewired. Its pretty nice if you only care to change one or 2 simple settings. (like name of build files, babel plugins, etc...)

https://github.com/timarney/react-app-rewired/

Re:Create React App 2.0: Babel 7, Sass, and More by ehavener on Tuesday October 02, 2018 @04:06AM (#18119615)
How difficult would it be to use this to add a staging environment? It seems like that's the only build config change that I ever desire.
Re:Create React App 2.0: Babel 7, Sass, and More by Raed667 on Tuesday October 02, 2018 @04:26AM (#18119705)
I'm not sure with what you mean by staging environment in this context. You can run your app in a webpack-devServer or build it then use your own server.

How does staging fit in here ?

Re:Create React App 2.0: Babel 7, Sass, and More by Waterluvian on Tuesday October 02, 2018 @01:57AM (#18119121)
Thanks. That sounds like a pretty elegant way to hide all that complexity. Let's hope things continue to converge and simplify into a more universal set of standards, defaults, and built ins.
Re:Create React App 2.0: Babel 7, Sass, and More by lilcorey10 on Tuesday October 02, 2018 @12:16PM (#18123005)
So sort of like what forking does on a Github repo?