useEvent hook in react18

85

useEvent hook in react18 -

function Chat() {
  const [text, setText] = useState('');

  const onClick = useEvent(() => {
    sendMessage(text);
  });

  return <SendButton onClick={onClick} />;
}

Comments

Submit
0 Comments