Is there a good way to force Solid to fully rerender a component when its props change?

I need to do some procedural computation on my props (I'm trying to draw grid lines based on a size and transformation), so I pretty much need a full rerender whenever the props change - is there a good way to do that?
2 Replies
Maciek50322
Maciek503227mo ago
Have you tried createEffect? If the lines themselves aren't signals I think it would be good solution to take props you need inside createEffect and there do redraw.
function Component(props) {

let gridRef;
createEffect(() => {
gridRef.drawLines(
props.size,
props.transform
);
});

return <Grid ref={gridRef}></Grid>
}
function Component(props) {

let gridRef;
createEffect(() => {
gridRef.drawLines(
props.size,
props.transform
);
});

return <Grid ref={gridRef}></Grid>
}
Starwort
StarwortOP7mo ago
This looks good, thanks!
Want results from more Discord servers?
Add your server