I am using useState inside Dialog in React Material UI.
and I use useCallBack Function like this.
const [count,setCount] = React.useState({
count: 0
})
const countCallback = useCallback(
() =>
setCount({
...count,
count : count.count + 1
}),[setCount,count])
It shows incremented number when I click increment Button to execute this Callback in ChildComponent.
But when I closing Dialog and open Dialog again, count reset to 0.
Is there any way I can memorize count inside dialog? I don't want to use Redux.