SolidJSS
SolidJSโ€ข3y agoโ€ข
15 replies
Mathieu

Make signal react on prop change

Say you initialize a signal by a prop:
const [error, setError] = createSignal(props.error);

If the prop changes, the signal won't react. What must be written is:
const [error, setError] = createSignal(props.error);
createEffect(() => setError(props.error));

Wonder if there's a more idiomatic way in SolidJS though ๐Ÿค”
Was this page helpful?