React to Preact codemod
See original GitHub issueFeature Request
I see that the Preact team has written useful codemods for Preact before: https://github.com/preactjs/migrate-preact-x
I think there should be an official codemod for converting from React to Preact. The codemod should support this:
- JSX/Create React App setups
- TypeScript
e.g., if I wanted to convert a TSX codebase to Preact, I would run preact codemod from-tsx
Motivation
reduce the react -> preact conversion friction, which has been preventing me from making the switch (converting seems like a task that can generally be automated)
Other Relevant Information
n/a
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
vutran/preact-codemod: Shave some bytes by using ... - GitHub
Learning and experimenting with jscodeshift by transforming React to Preact. Eventually can convert a big React application. Contributing. ♥ preact-codemod and ...
Read more >Switching to Preact (from React)
Switching to Preact can be as easy as installing and aliasing preact-compat in for react and react-dom . This lets you continue writing...
Read more >react-codemod - npm
Converts calls to React.createElement into JSX elements. npx react-codemod create-element-to-jsx <path> ...
Read more >Preact NPM - npm.io
Extensive React compatibility via a simple preact-compat alias; Everything you need: JSX, VDOM, React DevTools, HMR, SSR.. A highly optimized diff algorithm and ......
Read more >Etsy Moves from React to Preact - Hacker News
Speaking from building both react and Preact sites serving millions of customers ... React is usually not too much effort as for most...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’d certainly enjoy a tool that allowed for a quick switch, but I think the idea of a merged or migrated config is just too much to really hope for.
Something that just quickly changed up the imports and swapped out the packages like you mentioned would be great, though it would have to come with the huge caveat of “this has a decent chance of not working right out of the box”.
I see; thanks for the explanation. I agree that this seems unmaintainable so I’ll close this issue