November 2018
Beginner
502 pages
10h 22m
English
In the previous section, we saw how props can be set for functions with our onClick event handlers. In this section, we'll implement our own function props, so that the consumer of our component can execute some logic when the Ok and Cancel buttons are pressed.
interface IProps { title: string; content: string; cancelCaption?: string; okCaption?: string; onOkClick: () => void; onCancelClick: () => void;}
The props are required, so, we immediately get a compilation error in App.tsx when we reference the Confirm component. We'll fix this a little later.
Read now
Unlock full access