3 ms·
I ran into this same issue when setting up my own Redux/React with Hot reloading. The solution I found involved adding this to the store initializer: if (pro
by mercer 10y ago
I ran into this same issue when setting up my own Redux/React with Hot reloading. The solution I found involved adding this to the store initializer:
if (process.env.NODE_ENV !== 'production' && module.hot) {
module.hot.accept('./reducer', () => {
store.replaceReducer(require('./reducer'));
});
I still have issues with getting actions to hot reload, but from what I understand this will work once Hot Reloader 3 is released, so I'll just wait for that.
- aidos 10y agoThanks! I've decided to skip on boilerplate for the moment. I found that it wasn't very clear as to how to manage the code and I didn't find any obvious walkthroughs. Maybe for people with a little more experience it's useful but I found that it made everything a little murky for me. Since yesterday I've made good progress on my own app and I have have a much better understanding of how everything fits together. It might well be that boilerplate has the answers to some of my questions on how to manage the codebase but I just need to go through the process of figuring it all out for myself.
- mercer 10y agoYeah, I found that approach to be much better even if it feels like it takes longer. Only now that I've got a working todo app (based on a particular system) working, with a decent understanding of every part, I might look into this boilerplate (or another) to see what might be some 'best practices' and to see where I might've taken a suboptimal approach. I find that this generally is the best approach. Of course, the mistake I usually end up making, and one I made in this case, is that I try to learn too many things at once. For the current project: Redux, React (+ router stuff), Flowtype, Typescript, hot reloading, and something else I forget. Certainly didn't make things easier or more efficient, but it was hella fun! (Flowtype in particular is going to stick around for future projects where I don't want to go all-in on types. Typescript seems like a better long-term bet though, FWIW).