Subscribes to a reactive variable and provides its current value, updating the state when the variable is updated.
The type of the reactive variable's value.
The reactive variable to subscribe to.
The current value of the reactive variable.
import React from 'react'import { rv, useRv } from 'react-rv'const counter = rv(0)const Counter = () => { const value = useRv(counter) return ( <div> <p>Count: {value}</p> <button onClick={() => counter(value + 1)}>Increment</button> </div> )} Copy
import React from 'react'import { rv, useRv } from 'react-rv'const counter = rv(0)const Counter = () => { const value = useRv(counter) return ( <div> <p>Count: {value}</p> <button onClick={() => counter(value + 1)}>Increment</button> </div> )}
Subscribes to a reactive variable and provides its current value, updating the state when the variable is updated.