11597655d9
* Refactored the store so that it doesnt use getInitialProps * Applied the changes in the _app file * Refactored the wrapper so that it uses the new store flow * Removed the old redux syntax Instead of passing the state from the parent component, I have used the new redux hooks to retrieve the current state. * The clock no longer requires state to be passed too * Updated the variable names * forgot to bring back hot reloading * Applied requested change.
23 lines
485 B
JavaScript
23 lines
485 B
JavaScript
import { useEffect } from 'react'
|
|
import { useDispatch } from 'react-redux'
|
|
import Link from 'next/link'
|
|
import { startClock } from '../actions'
|
|
import Examples from '../components/examples'
|
|
|
|
const Index = () => {
|
|
const dispatch = useDispatch()
|
|
useEffect(() => {
|
|
dispatch(startClock())
|
|
}, [dispatch])
|
|
|
|
return (
|
|
<>
|
|
<Examples />
|
|
<Link href="/show-redux-state">
|
|
<a>Click to see current Redux State</a>
|
|
</Link>
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default Index
|