Jake Boone
Jake Boone
SSolidJS
Created by Jake Boone on 1/17/2024 in #support
Share JSX code with a React codebase?
I'm trying to port my React form library to Solid. When I started the process, I realized the JSX for each component was identical to its React counterpart. For most of my components, the only React-specific code in the entire file is the import * as React from 'react' and a React.memo wrapper. The logic for each component is encapsulated in its own bespoke hook, which I can refactor as a Solid hook fairly easily. The code in the component function itself is no different. To avoid copy/pasting the code, is there a way to share JSX between a React codebase and a Solid codebase? Seems like if the actual text of the source file can be the same, there should be some way to do it.
8 replies