Replies: 1 comment
-
|
Just out of my curiosity, any performance benefit gained from the porting? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I just ported a ~6,000-line CoffeeScript app (shared whiteboard) from React to Solid. I'm hoping it serves as a useful example of what could be mostly automated by a codemod.
Here's the commit, which is mostly the port though a few other changes as well: edemaine/cocreate@554cd86
This includes everything I needed to change, including eslint and Meteor settings.
Some patterns I noticed, many of which would be easy to automate:
useEffectwith return function converted intocreateEffectoronMountwithonCleanup([Feature]: Transform useState/useEffect of ReactJS to createSignal/onCleanup of SolidJS. #1)useRenderEffectshould correspond to; in some cases I usedcreateRenderEffectto force early evaluation, but it's really closer tocreateEffectso I often used that.useRefand.current([Feature]: Transform ReactJS useRef into simple let #3)useStatetocreateSignaland adding lots of parentheses ([Feature]: Transform useState/useEffect of ReactJS to createSignal/onCleanup of SolidJS. #1)react-router-domtosolid-app-router. For example,pathis calledpathname,useHistoryis roughly equivalent touseNavigate, etc.useTrackertocreateTrackerandreact-meteor-datatosolid-meteor-data(this is Meteor specific)classNametoclass(for cleaner code)splitProps, etc. ([Feature]: Undestructuring of props and automatic splitProps #5)React.memoeverywherestyle={undefined}behaves very differently between React (which just deletes defined styles) and Solid (which deletes everything).Beta Was this translation helpful? Give feedback.
All reactions