How to make React.Children.map work with Typescript?

Viewed 212

I have a component named WizardStep:

const WizardStep: React.FC<{ title: string }> = () => { /*  */}

And another named Wizard. The latter accepts one or several WizardStep as children.

And it uses React.Children.map as follows:

Children.map(
   children, // a set of WizardStep
   ({ props: { title } }) => title
)

But Typescript says TS2339: Property 'props' does not exist on type 'FC{ title: string; }>'.

How do I go about this?

0 Answers
Related