5 ms·
Is it possible to use Redux without an eject?
by magicbuzz 8y ago
Is it possible to use Redux without an eject?
- daok 8y agoIt always been...
- magicbuzz 8y agoand redux-saga?
- seankimdesign 8y agoOf course redux-saga can be used. Unless your goal is to rewire the project compilation step, ejecting is rarely required.
- acemarke 8y agoAbsolutely - 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 https://redux.js.org/recipes/configuringyourstore [1] https://github.com/markerikson/redux-starter-kit https://github.com/markerikson/redux-starter-kit [2] https://blog.isquaredsoftware.com/2018/10/presentation-state-of-redux/ https://blog.isquaredsoftware.com/2018/10/presentation-state...
- danabramov 8y agoYou can add any JavaScript library without ejecting. Unless it demands changes to your build process.
- Waterluvian 8y agoForgive me. What is "eject"?
- acemarke 8y agoThe 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.
- Waterluvian 8y agoThanks. 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.
- Raed667 8y agoYou 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/ https://github.com/timarney/react-app-rewired/