react redux with functional components code example
Example 1: implementation of redux in functional component
import React from 'react'
import { useSelector } from 'react-redux'
export const CounterComponent = () => {
const counter = useSelector(state => state.counter)
return <div>{counter}</div>
}
Copy
Example 2: useDispatch()
useDispatch({ type: '', playload });