Using SolidJS primitives in a React app #1792
guillaumebrunerie
started this conversation in
General
Replies: 1 comment 6 replies
-
Do you mean like sharing state between React and Solid? If so, you can't, because they have separate runtimes, at least not without performance heavy glue code and state wrappers, then you will have problems compiling componets because both use JSX. Chosing one as the main tool and rendering branches on the main app using the other one is your best option but you already said that you didn't like it. Try preact, they have a very close signal implementation to Solid's. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been using React and Redux for quite some time, and I have started looking at SolidJS recently. I am not yet really sold on the way rendering works in Solid (I understand it and see some benefits, but I'll probably stick with React for now), however I am really interested in the reactive primitives themselves, that is
createSignal
,createMemo
,createEffect
, andcreateStore
, and in particular I am thinking about using them in a React app.I tried at reduxjs/react-redux#2043 a proof of concept for an alternative implementation of Redux using Solid stores, which leverages reactivity to know exactly which components to rerender instead of having to run every single selector after every dispatched action (like normal Redux). I haven’t tested it in a real app yet, so take it with a big pinch of salt, but in a toy example it seems to work, and I could also relatively easily make things like memoized selectors and debounced selectors in a much easier way than with Redux.
Has anyone else tried to use Solid's primitives inside a React app?
I have also tried to look for other similar state management libraries for React, but for instance Jotai has signals, but nothing like stores, and Valtio has stores, but nothing like signals or
createMemo
(that I could find), whereas Solid seems to have all that I need.Beta Was this translation helpful? Give feedback.
All reactions