Skip to content

Instantly share code, notes, and snippets.

@pavinduLakshan
Created May 12, 2020 05:59
Show Gist options
  • Save pavinduLakshan/6f3bad21a076d2fb0cdf23f11e0ea499 to your computer and use it in GitHub Desktop.
Save pavinduLakshan/6f3bad21a076d2fb0cdf23f11e0ea499 to your computer and use it in GitHub Desktop.
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