solid-docs
solid-docs copied to clipboard
Mention gotchas regarding `createMutable`
@ryansolid mentioned that there are some gotchas with mutables, and we should document them. They aren't mentioned.
From discord:
there are just so many more considerations mutables bring and I didn't really design for them since i never use them for anything. I probably should have just left them to 3rd party
I believe createMutable is an excellent API. I use it for internal state in my components because the dev experience is far better than having to write setter calls to modify stores made with createStore.
The majority of the time, we do not need read/write segregation for a component's internal state, so writing the following is simpler:
function MyCounter() {
const state = createMutable({
count: 0
})
setInterval(() => state.count++, 1000)
return <div>Count: {state.count}</div>
}
I haven't ran into any issues with mutables yet, and I've been using them exclusively for component state in an app at work. Knowing what issues exist, and documenting them, will go a long way.
Ok, quick look and it's this file that's the issue of course... it's just an <Outlet/> so the fact that it renders (and is not a 404) but is blank makes perfect sense. Is there actually a child route anywhere or should it be a 404 or maybe <Navigate href={https://start.solidjs.com}/>