Skip to content

Instantly share code, notes, and snippets.

@oney
Created June 3, 2022 08:27
Show Gist options
  • Save oney/3558a032c4fab7ab4c1c2e65d0ad8363 to your computer and use it in GitHub Desktop.
Save oney/3558a032c4fab7ab4c1c2e65d0ad8363 to your computer and use it in GitHub Desktop.
const SendButton = withStable(["onClick"], ({ onClick }) => (
<button onClick={onClick}>click</button>
));
function ChatA({text}) {
const onClick = () => sendMessage(text);
// 😃 No need to do anything else
return <SendButton onClick={onClick} />;
}
function ChatB({text}) {
const onClick = () => sendMessage(text);
// 😃 No need to do anything else
return <SendButton onClick={onClick} />;
}
function ChatC({text}) {
const onClick = () => sendMessage(text);
// 😃 No need to do anything else
return <SendButton onClick={onClick} />;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment