Learn how to create and update reactive state with just one hook. No Redux, no Context, no complexity.
useSignal(initialValue)setCount(newValue)๐ Try the buttons below!
import { useSignal } from 'signalforge/react';const [count, setCount] = useSignal(0); // Start at 0{count} // Display the value
setCount(count + 1) // Update itimport { useSignal } from 'signalforge/react';
function Counter() {
// Create a signal with initial value 0
const [count, setCount] = useSignal(0);
return (
<div>
<h1>Count: {count}</h1>
{/* Update the signal */}
<button onClick={() => setCount(count + 1)}>
Increment
</button>
<button onClick={() => setCount(0)}>
Reset
</button>
</div>
);
}
// That's it! Your component will automatically
// re-render when count changes. No useEffect,
// no useCallback, no useMemo needed!Now that you understand basic signals, try these demos: