wonrax
wonrax
SSolidJS
Created by wonrax on 9/18/2023 in #support
Difference between `setState` and `produce`?
I've been trying for a while and it seems impossible to make a reproducible code but this is the closest I can get: https://playground.solidjs.com/anonymous/ef126951-8ad2-4aa6-ac89-91bd1b40fb0b With this code the createEffect in the child component is registered and fired correctly (mine is not). But if you cycle through the buttons they behave weirdly. The first button you click will have its state changed when you click other buttons, my app also behaves like this. Maybe this is closely related to the problem.
12 replies
SSolidJS
Created by wonrax on 9/18/2023 in #support
Difference between `setState` and `produce`?
It doesn't in my case though and I still don't know why. The usage:
<TableView
class="overflow-auto"
table={appState.selectedTable}
connection={appState.connection!}
/>
<TableView
class="overflow-auto"
table={appState.selectedTable}
connection={appState.connection!}
/>
const TableView: Component<{
table?: DatabaseTable;
connection: DatabaseConnection;
class?: string;
}> = (props) => {
createEffect(() => {
console.log("createEffect table changed", props.table);
});
...
}
const TableView: Component<{
table?: DatabaseTable;
connection: DatabaseConnection;
class?: string;
}> = (props) => {
createEffect(() => {
console.log("createEffect table changed", props.table);
});
...
}
12 replies