Created
May 12, 2020 05:59
-
-
Save pavinduLakshan/6f3bad21a076d2fb0cdf23f11e0ea499 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { useDispatch } from 'react-redux' | |
const AnotherChildComponent = () => { | |
const dispatch = useDispatch() | |
function changeTheme (theme) { | |
dispatch({ | |
type: 'CHANGE_THEME', | |
theme: theme | |
}) | |
} | |
return ( | |
<div> | |
{/* | |
Here you can call changeTheme so that it's value is sent to the store | |
*/} | |
</div> | |
) | |
} | |
export default AnotherChildComponent; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment