João Bezerra
João Bezerra
Explore posts from servers
SSolidJS
Created by João Bezerra on 7/27/2024 in #support
How to wrap a store without losing reactivity
Nice! I guess this answers my question 🙂
13 replies
SSolidJS
Created by João Bezerra on 7/27/2024 in #support
How to wrap a store without losing reactivity
I was gonna say it would be cool if there was an utility for this. Also didn't know mergeProps could be used here.
13 replies
SSolidJS
Created by João Bezerra on 7/27/2024 in #support
How to wrap a store without losing reactivity
Interesting. Can you clarify what you mean by "feel like a real object"?
13 replies
SSolidJS
Created by João Bezerra on 7/27/2024 in #support
How to wrap a store without losing reactivity
Isn't there a way to do this with userWrapper being a proxy?
13 replies
SSolidJS
Created by João Bezerra on 5/8/2024 in #support
Should I disable `solid/reactivity` linter warning in this case?
Okay, thanks for your help!
16 replies
SSolidJS
Created by João Bezerra on 5/8/2024 in #support
Should I disable `solid/reactivity` linter warning in this case?
I see. Would you say then that, of the people that use eslint-plugin-solid, most just disable the warning?
16 replies
SSolidJS
Created by João Bezerra on 5/8/2024 in #support
Should I disable `solid/reactivity` linter warning in this case?
Oh, I hadn't thought of putting the event handler outside of the component function. Is this a common idiom?
16 replies
SSolidJS
Created by João Bezerra on 5/8/2024 in #support
Should I disable `solid/reactivity` linter warning in this case?
Could I define handleInput outside the jsx and still be able to access item without running into the linter warning?
16 replies
SSolidJS
Created by João Bezerra on 5/8/2024 in #support
Should I disable `solid/reactivity` linter warning in this case?
Let me give a concrete example.
import { For } from "solid-js"

type PropsType = {
something: string;
}

const SomeComponent = (props: PropsType) => {
const [items, setItems] = createSignal(["One", "Two", "Three"]);

const handleInput = (item: string, value: string) => {
print(props.something, item, value);
}

return (
<div>
<For each={items()}>
{(item) => (
<input onClick={(event) => handleInput(item, event.currentTarget.value)} />
)}
</For>
</div>
);
}
import { For } from "solid-js"

type PropsType = {
something: string;
}

const SomeComponent = (props: PropsType) => {
const [items, setItems] = createSignal(["One", "Two", "Three"]);

const handleInput = (item: string, value: string) => {
print(props.something, item, value);
}

return (
<div>
<For each={items()}>
{(item) => (
<input onClick={(event) => handleInput(item, event.currentTarget.value)} />
)}
</For>
</div>
);
}
16 replies
SSolidJS
Created by João Bezerra on 5/8/2024 in #support
Should I disable `solid/reactivity` linter warning in this case?
Right, but then I wouldn't be able to use InputEventHandler.
16 replies
SSolidJS
Created by João Bezerra on 5/8/2024 in #support
Should I disable `solid/reactivity` linter warning in this case?
What if I need to pass something else to the handler other than the event?
16 replies
SSolidJS
Created by João Bezerra on 5/2/2024 in #support
Is it ok to use a global store to persist component state between mounts?
thanks!
20 replies
SSolidJS
Created by João Bezerra on 5/2/2024 in #support
Is it ok to use a global store to persist component state between mounts?
oh, yeah, I understand that
20 replies
SSolidJS
Created by João Bezerra on 5/2/2024 in #support
Is it ok to use a global store to persist component state between mounts?
I mean, would it be a problem to use a global store if I also wanted to persist state after a page refresh?
20 replies
SSolidJS
Created by João Bezerra on 5/2/2024 in #support
Is it ok to use a global store to persist component state between mounts?
So what would the problem be with regards to global stores?
20 replies
SSolidJS
Created by João Bezerra on 5/2/2024 in #support
Is it ok to use a global store to persist component state between mounts?
If it did though, wouldn't that just be a matter of saving to localStorage/database when state changed and restoring it on mount if it exists?
20 replies
SSolidJS
Created by João Bezerra on 5/2/2024 in #support
Is it ok to use a global store to persist component state between mounts?
No
20 replies
SSolidJS
Created by João Bezerra on 5/2/2024 in #support
Is it ok to use a global store to persist component state between mounts?
What do you mean? A page refresh?
20 replies
SSolidJS
Created by João Bezerra on 5/2/2024 in #support
Is it ok to use a global store to persist component state between mounts?
If for some reason you want to render that component elsewhere and you did not expect the state to be transferred there as well.
You mean, if I had two instances of a component which uses a global store, the problem would be that they would both share the same store instead of each having a separate store?
Resetting that state can sometimes be too important to leave to chance.
I don't understand what you mean by this. How does using a global store mean the same as or have as a consequence that resetting that state would be left to chance?
20 replies
SSolidJS
Created by João Bezerra on 5/2/2024 in #support
Is it ok to use a global store to persist component state between mounts?
@deluksic Can you explain how using a global store in this way could cause a problem?
20 replies