I'm struggle with createResource
I'm noob guys, I thought solidjs could be that easy sorry...
5 Replies
Not tested, just a sketch:
-
Show
- For
- Suspense
- ErrorBoundary
- Derived signals
Just because it uses JSX doesn't mean it's a React clone.
The ErrorBoundary
can't do its job if you swallow the error in the fetcher.<Show> - SolidDocs
Documentation for SolidJS, the signals-powered UI framework
<For> - SolidDocs
Documentation for SolidJS, the signals-powered UI framework
<Suspense> - SolidDocs
Documentation for SolidJS, the signals-powered UI framework
Error boundary - SolidDocs
Documentation for SolidJS, the signals-powered UI framework
Derived signals - SolidDocs
Documentation for SolidJS, the signals-powered UI framework
Not working pretty much but good templating, thanks!
Just wonder how reactive function works, whats different between assigning in variable and function
If you are talking about this:
It's used here:
Solid's JSX is implicitly wrapped in a render effect.
- When
boardData()
runs the first time it also runs myBoard()
(a dependency); that automatically subscribes boardData()
to be run again once myBoard()
changes.
- Once myBoard()
has changed, boardData()
will be rerun for Show
which can then change based on its current value.
You simply can't do that with plain variables without some kind of compiler magic.
For details: Building a Reactive Library from ScratchDEV Community
Building a Reactive Library from Scratch
In the previous article A Hands-on Introduction to Fine-Grained Reactivity I explain the concepts...
Not working pretty muchHere is a working example for you to experiment with: https://playground.solidjs.com/anonymous/7a6867fb-3b38-4d38-828c-3c7e9c1561ab (The playground seems to be incredibly sluggish for the first bundling right now)
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
Version using the updated
query
/createAsync
API available via @solidjs/router
now and later standard with Solid 2.x:
https://playground.solidjs.com/anonymous/d084d8b4-b955-4d69-8105-f8886a0ab0bcSolid Playground
Quickly discover what the solid compiler will generate from your JSX template