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:
useEffect
with return function converted intocreateEffect
oronMount
withonCleanup
([Feature]: Transform useState/useEffect of ReactJS to createSignal/onCleanup of SolidJS. #1)useRenderEffect
should correspond to; in some cases I usedcreateRenderEffect
to force early evaluation, but it's really closer tocreateEffect
so I often used that.useRef
and.current
([Feature]: Transform ReactJS useRef into simple let #3)useState
tocreateSignal
and adding lots of parentheses ([Feature]: Transform useState/useEffect of ReactJS to createSignal/onCleanup of SolidJS. #1)react-router-dom
tosolid-app-router
. For example,path
is calledpathname
,useHistory
is roughly equivalent touseNavigate
, etc.useTracker
tocreateTracker
andreact-meteor-data
tosolid-meteor-data
(this is Meteor specific)className
toclass
(for cleaner code)splitProps
, etc. ([Feature]: Undestructuring of props and automatic splitProps #5)React.memo
everywherestyle={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