Answers for "react redux hooks"

1

react redux hooks

import React from "react";
import { useDispatch, useSelector } from "react-redux";
import { addCount } from "./store/counter/actions";

export const Count = () => {
  const count = useSelector(state => state.counter.count);
  const dispatch = useDispatch();

  return (
    <main>
      <div>Count: {count}</div>
      <button onClick={() => dispatch(addCount())}>Add to count</button>
    </main>
  );
};
Posted by: Guest on April-26-2020
2

useDispatch()

useDispatch({ type: '', playload });
Posted by: Guest on July-18-2020
0

useSelector

const result: any = useSelector(selector: Function, equalityFn?: Function)
Copied
Posted by: Guest on October-02-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language