purescript-react/purescript-react-basic

react-hot-loader support

kevinbarabash opened this issue · 9 comments

Is there any way to use React.Basic with https://github.com/gaearon/react-hot-loader?

I would expect it to just work, though you'd need to do the setup from a JS entrypoint (same as a JS project). That said, it's likely to be more finicky than using from JS, since you may get runtime errors when types are changed. I guess you'd get that from JS too?

If you run into problems, go ahead and reopen this.

I was hoping to use the hot() wrapper, but that has to wrap the root component, but in the file it's being defined it. Looking at the react-hot-loader docs again, it looks like using AppContainer is probably the way to go since I can use it in a JS entry point.

I got hot loading working. Currently it re-renders the root component. Unfortunately, it doesn't maintain state between updates.

All state, or only the state in the component with the change?

I have a very simple test app I'm working on so all my state is currently component state.

Sorry, I wasn't clear. If your app root renders two components -- A and B -- and each have their own state, does editing A cause both to lose their state, or just A?

The app contains a single component. I'll post my code in a little bit.

@kevinbarabash did you made it work?