useEvent hook in react18

89

useEvent hook in react18 -

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

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

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

Comments

Submit
0 Comments