I am new to typescript, I was facing problems while passing the function of the parent component as a prop to another component, I searched online but nothing was useful
For reference, I am attaching JSX Code here, [TSX is what I wish]
This is parent component
export default function Notification() {
const [notification, setnotification] = useState(['alert', 'booking'])
return (
<div>
<ShowNotification setnotification={setnotification} notification={notification} />
</div>
)
}
This is child component
const ShowNotification = ({notification,setnotification}) => {
notification.map((item, index) => {
<li>item</li>
})
}
The main issue for me is specifying prop types in typescript