Skip to content

Instantly share code, notes, and snippets.

@ms314006
Last active January 29, 2023 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ms314006/67ce9af7e3d64a2a4020adfa290c388a to your computer and use it in GitHub Desktop.
Save ms314006/67ce9af7e3d64a2a4020adfa290c388a to your computer and use it in GitHub Desktop.
const CommentButton = () => {
const { data: user } = useUser();
return (
<button onClick={user?.id ? user.submitComment : () => { /* 導到登入頁面 */ }}>
送出留言
</button>
);
};
const Header = () => {
const { data: user } = useUser();
return (
<div>
{ `${user?.name || '遊客'}您好!` }
</div>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment