title: Send onClick function as props to a component in React with Typescript
body: <p>I'm new to Typescript and I have to write a parent component that sends as props onClick to the child component where is a button that triggers the functionality of onClick when clicked.</p>
  <p>Here is the code:</p>
  <pre><code>export function ParentComponent(props: ParentComponentProps) { 
    const [isOpened, toggleModal] = useToggle(false);
   // useToggle is a custom hook that toggles a boolean
    ...
    const onClick = () =&gt; {
      toggleModal();
    }
  
    return (
            &lt;ChildComponent onClick={onClick} /&gt;
           );
  }
  </code></pre>
  <p>For the child component I don't know how to define the interface, what should be put here?</p>
  <pre><code>export interface ChildComponentProps {
     onClick: &lt;unknown&gt;();  // what to add here?
  }
  </code></pre>
  <p>And here is the child component:</p>
  <pre><code>export function ChildComponent({onClick}: ChildComponentProps) {
     ...
     return ( 
              &lt;div&gt;
              ...
                 &lt;ButtonComponent 
                    onClick={() =&gt; onClick()}
                    ...
                 /&gt;
              ...
             );
  }
  </code></pre>
  <p>Any ideas what to add to the interface or if there should be any other changes to be Typescript correct?</p>