react-universal-component icon indicating copy to clipboard operation
react-universal-component copied to clipboard

Question: Refactor library with hooks

Open jaybe78 opened this issue 6 years ago • 6 comments

Hi @ScriptedAlchemy,

Any plan to use hooks instead of HOCs in the library ?

jaybe78 avatar Nov 13 '19 17:11 jaybe78

Yeah, I'm working on another project which is very similar. It uses hooks, once I finalize it ill backport the mechanism to RUC

ScriptedAlchemy avatar Nov 13 '19 20:11 ScriptedAlchemy

@ScriptedAlchemy I'll be more than happy to contribute if you need help

jaybe78 avatar Nov 13 '19 23:11 jaybe78

I wouldn’t mind some assistance giving it updates. So if you’re keen I’ll gladly accept a pr!

ScriptedAlchemy avatar Dec 01 '19 00:12 ScriptedAlchemy

Moving to hooks is tricky because the class based system lets me execute static’s ahead of time.

ScriptedAlchemy avatar Jan 31 '20 08:01 ScriptedAlchemy

Do preload and prelodWeak really matters ? The docs says that those statics can be called if there's a likelihood modules will show up soon. To be honest I've not used those in my project, I'm mainly interested in code splitting and requiring module asynchronously. That's only from my point of view though, but I don't think that prevents us from building from scratch a new implementation of react universal with hooks.

jaybe78 avatar Jan 31 '20 09:01 jaybe78

Those were used previously but no they are no popular features. It could be possible to further upgrade. If you’re interested in getting something started. I’ll likely pick up the PR and help. Either way I need the suspense part. I’ve got a hooks based async component in webpack-external-import. Take a look at the src/react file. That might be able to be ported over

ScriptedAlchemy avatar Jan 31 '20 09:01 ScriptedAlchemy