Open qkreltms opened 3 years ago
Describe the bug Cannot listen list actions when it provided by props. To Reproduce
import React, { useState } from "react"; import { useActionListener } from "react-action-listener"; const ListenMultipleAction = (actions) => { //1. get listening actions by props const [callNum, setCallNum] = useState(0); useActionListener(actions, () => { setCallNum((num) => num + 1); }); return ( <> <h3>All action dispatched cnt: {callNum}</h3> </> ); }; export default ListenMultipleAction; <ListenMultipleAction actions={["ADD", "SUB", "P_SUB", "P_ADD"]} /> // 2. Now dispatch 'ADD' // 3. Nothing happens
Additional context It due to ['actions'] !== ['actions'] in useActionListener
https://github.com/facebook/react/issues/14476#issuecomment-471199055
Describe the bug Cannot listen list actions when it provided by props. To Reproduce
Additional context It due to ['actions'] !== ['actions'] in useActionListener