Comments (7)
Although I find redux-simple-router to be very elegant - I dislike the fact that it prevents you from using immutablejs Map as your state. That's because of this line:
https://github.com/rackt/redux-simple-router/blob/master/src/index.js#L43
Once you let libraries like redux-(simple-)router manipulate your state you have to make your state a simple JS object. If you choose to use Immutablejs for the benefits of strict immutability - you need to wrap it with an object - and it's truly annoying.
from react-boilerplate.
I'm not currently using Immutable JS because I'm not sure why I should include it. What are the benefits?
from react-boilerplate.
I wanted a way to prevent state manipulation - and the subtle bugs that follow. For example - if during shouldComponentUpdate you compare your previous state to the new state - you'll always get equality because it's the same instance.
This sort of "defensive" design is sometimes necessary when working with a team.
Also, using an API such as ImmutableJS' makes you stop and think of things like 1. where do you perform the state manipulation (you don't want to start importing immutablejs everywhere) and 2. what's the cost of the manipulation (copying huge collections much?).
Lastly - some strong functionality out of the box (things you'll usually use lodash for).
I'm not saying you should use ImmutalbeJS - but take into account that enough projects use it for it to be a consideration.
from react-boilerplate.
I see what you mean. And how does the Object.assign in redux-simple-router interfere with that?
from react-boilerplate.
Short answer: Object.assign returns an object - not an Immutable.Map. So you have a Map as your state and after their reducer is called you suddenly have a simple object.
The idea behind redux-simple-router (and also redux-router) is to take your state object and add their own subtree for routing state. But they assume your root state instance is of an object type. They can simply change it by allowing you to provide a custom reducer - and I opened a bug.
from react-boilerplate.
Ah I see, thanks very much for the info, I didn't consider that at all!
I won't be including redux-simple-router then, lets revisit this when reactjs/react-router-redux#140 is added!
from react-boilerplate.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
from react-boilerplate.
Related Issues (20)
- The DLL files are missing. Sit back while we build them for you with "npm run build-dll" HOT 1
- not working on macbook
- Include relative static files from index.html HOT 3
- Migration from old boiler plate to CRA base boiler plate
- updating node 12 to node 16 HOT 1
- micro frontend structer HOT 1
- upgrade package and project HOT 1
- ngrok - platform darwinarm64 is not supported HOT 3
- caniuse-lite is outdated HOT 1
- Not able setup react boilerplate on Windows 10 Home Single Language
- Existence of security vulnerabilities
- opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error'
- Actions calling in different containers HOT 1
- Install New Project
- your website is down
- upgrade the project from react-boilerplate to cra-react-boilerplate
- migrating to react-router-dom v6 HOT 2
- How to migrate from react-boilerplate to react CRA? HOT 1
- Website appears compromised
- After upgrading react 18 version and node to 20 version getting below erro
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-boilerplate.