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

master
Jason Zhu 2022-03-26 16:50:56 +11:00
parent 5772c175af
commit e3810cc810
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>