nodegui / react-nodegui-starter

Starter repository for react based native desktop apps using react-nodegui
172 stars 31 forks source link

Hot loading for Flow not working #31

Open neosarchizo opened 4 years ago

neosarchizo commented 4 years ago

Hi. Because I prefer to use Flow so I forked this repo and migrated to Flow environment. my repo

But the hot loading is not working. I added webpack plugins for Flow. But I don't know why it doesn't work.

NickSeagull commented 4 years ago

For some reason, the uppermost component (App) has to be a class in order for the hot-reloading to work

a7ul commented 4 years ago

Yes, the root component has to be a class component at this time because it uses traditional hot reloading method at the moment. But soon we should be moving to the react's fast refresh ( a fancier version of hot reloading) that should solve this. For the time being, there is that limitation.

a7ul commented 4 years ago

@neosarchizo Hot reloading doesnt really depend on the type system you use. It makes use of react and webpack's native hot reload feature.

neosarchizo commented 4 years ago

@master-atul Ah I see. But when I use hot loading in CRA project, the root component is function based and the hot loading is working well. Does your hot loading method differ from it?

a7ul commented 4 years ago

Yes, CRA uses React-hotloader i think which inturn uses react-dom. But since we cant use react-dom, we had to use the hot reloading component (specifically react-proxy) which was previously used with React native aswell (before fast refresh).

I had a quick look at your code, it should have worked since you only swapped out typescript. But I cant seem to be able to make it work either. Maybe i ll take a look again when I have more time.

But if we can't make it work, then we might have to wait till we can implement fast refresh instead.