I'm gonna dispatch an action by clicking.
export default function Example() {
const dispatch = useDispatch()
function dispatching() {
dispatch(action)
}
return (
<Parent onClick={dispatching}>
<Child />
</Parent>
)
}
I want nothing happens when I click the child one. But it's hard to solve it because of the bubbling, I guess. I don't think it is related to e.stopPropagation(), because that is useful when I want to click the child one, not the parent one. This is the opposite situation. I already have tried it for if I'm confused, and it didn't work as expected. Please help me, thank you.