score:4

Accepted answer

according to your definition of the pokemoncard component, you should be passing the pokemonitem as follow:

<pokemoncard pokemonitem={item} key={item.id} />

i have replaced the key prop as it is not recommended to use indexes as keys (see documentation), you could use the item's id instead. and you need to update the prop interface for the pokemoncard component so that the additional key prop doesn't break the validation:

interface props {
  pokemonitem: pokemonitem;
  key: string;
}

score:0

use propswithchildren from react:

import react, {component, propswithchildren} from "react";

interface ownprops {
    foo?: barcomponent;
}

// for class component
class mycomponent extend component<propswithchildren<ownprops>> {
   ...
}

// for fc
const myfunctioncomponent: fc<propswithchildren<props>> = ({
    children,
}) => (...)

score:3

try this (add type for you component):

export const pokemoncardlist: react.fc<props> = (props) => {}


Related Query

More Query from same tag