Chap03 -> Handling events -> Handling a button click event

Chap03
Yiqing Zhu 2022-03-26 16:50:56 +11:00
parent 0f31f492cc
commit 7dd02a76ea
1 changed files with 4 additions and 3 deletions

View File

@ -17,14 +17,15 @@ export const HomePage = () => {
doGetUnansweredQuestion();
}, []);
console.log('rendered');
const handleAskQuestionClick = () => {
console.log('TODO - move to the AskPage');
};
return (
<Page>
<div>
<PageTitle>Unanswered Questions</PageTitle>
<button>Ask a question</button>{' '}
{/* This button component is passed as children of Page */}
<button onClick={handleAskQuestionClick}>Ask a question</button>
</div>
{questionsLoading ? (
<div>Loading...</div>