connect functional component to redux code example
Example 1: redux import connect
import { connect } from 'react-redux'
Example 2: 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 3: useSelector
const result: any = useSelector(selector: Function, equalityFn?: Function)
Copied