react useSelector code example

Example 1: react usestate

import React, { useState } from 'react';

function Example() {
  // Declare a new state variable, which we'll call "count"
  const [count, setCount] = useState(0);

  return (
    <div>
      <p>You clicked {count} times</p>
      <button onClick={() => setCount(count + 1)}>
        Click me
      </button>
    </div>
  );
}

Example 2: useDispatch()

useDispatch({ type: '', playload });

Example 3: useSelector

const result: any = useSelector(selector: Function, equalityFn?: Function)
Copy

Example 4: useSelector

const result: any = useSelector(selector: Function, equalityFn?: Function)
Copied