reactjstypescript

Property 'children' does not exist on type '{}'


I'm having a typescript error. It says that 'children' does not exist on type '{}' even though this syntax works on my other projects.


Solution

  • You have not defined a type for React.FC

    The fix could be

    type Props = {
       children: React.ReactNode
    }
    
    const Page: React.FC<Props> = ({ children }) => {
      ...
    }