use redux in react component 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: react redux
# If you use npm: npm install react-redux # Or if you use Yarn: yarn add react-redux