Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

usedispatch

import { useDispatch } from "react-redux";

import increment from "./action";

function Button() {

  const dispatch = useDispatch();

  const handleClick = () => {

    dispatch(increment);

  };

  return (

    <div>

      <button onClick={handleClick}> Click here </button>

    </div>

  );

}

export default Button;
Source by javarevisited.blogspot.com #
 
PREVIOUS NEXT
Tagged: #usedispatch
ADD COMMENT
Topic
Name
3+9 =