tozz
Explore posts from serversSolid Router 0.10.x double render of App
<App>
it gets rendered twice, whereas if I just have <>...</>
it renders fine.
This causes double rendering (two 'standard-grid' divs, two menus etc).
This works (but adding the div inside the <> causes it to render double again.
Router is setup very simply with <Router root={App}>...
1 replies
Best way of passing props from Provider to Context
So I'm making a simple context with a Provider "wrapper" as is quite common to wrap functionality. I pass some values to it in JSX that should then be available when using the context.
This works well, but curious as to if there's a smarter way that I'm missing. Solid isn't wrapping reactivity for the
value
attribute, so I need to do something to keep reactivity.
For usage of the provider it looks like this:
6 replies
Reactivity inside closure in return value
I have a function with a store, singals etc. This function returns an object, that object contains a function that is to be used as an event in the caller context.
const { onSubmit } = someFunction()
The definition of onSubmit inside someFunction
So the way you use it is <form onSubmit={onSubmit(() => { // my callback })} ...>
This causes a lint error This function should be passed to a tracked scope (like createEffect) or an event handler because it contains reactivity, or else changes will be ignored.
on the returning inner function. Likely very simple to fix, if I didn't need the closure for callback
I could just store the inner function with createMemo
, but I need the closure5 replies
Reaching into nested properties and keeping them reactive?
Coming from React I really like that I can destruct nested props into single variables, in this example I have a JSON (using
createResource
with flow
as the signal) that has a couple of levels where I parse it and loop it over with a <For>
<For each={flow().ui.nodes}>{nodeValue}</For>
The nodeValue
function looks like this (I could of course inline it all, and I might, but for now it's its own function)
Can I avoid having to do node.attributes.x
and rather get node.attributes
as a flat var and use var.name
instead?3 replies