Hacker News new | ask | show | jobs
by aidos 3689 days ago
So far this feels really nice, kudos!

Quick question - what does the HMR work with? If I change a component it seems ok, if I change a reducer it blows up in my face.

EDIT is there a walkthrough of getting set up with this anywhere? After about 30 minutes playing I think I'm going to put this down until there's an obvious way of building a simple app with it.

1 comments

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.
Thanks!

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.

Yeah, 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).