Pass reactive props to useSetup in React
When a second argument is passed to
useSetup, it is provided to the callback as a reactive atom. This allows you to reactively track props within the setup closure.import { subscribe, use } from 'xoid'
import { useSetup } from '@xoid/react'
const App = (props: Props) => {
useSetup(($props) => {
// `$props` has the type: Atom<Props>
$props.focus(s => s.something).subscribe(console.log)
}, props)
return (<div>...</div>)
}