-
export default function App() {
const [n, setN] = useState(1);
const obj = { foo: n };
useControls(obj, [obj]);
return (
<div>
<button
onClick={() => {
setN((n) => n + 1);
}}
>
increase
</button>
<pre>{JSON.stringify(obj, null, " ")}</pre>
</div>
);
} When I click the button I expect that foo field value would be updated in leva UI. |
Beta Was this translation helpful? Give feedback.
Answered by
dbismut
Feb 24, 2023
Replies: 1 comment 4 replies
-
Is there a specific reason why you'd be using Leva like this, with |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
user753
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there a specific reason why you'd be using Leva like this, with
useState
? The reason it doesn't work is because the deps array only modifies the settings, not the value of the inputs.