score:4
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) => {}
Source: stackoverflow.com
Related Query
- How to remove Property 'length' does not exist on type '{}' in React Typescript
- TypeScript errors in React Class Component property does not exist on type 'Readonly<{}>', not sure how to set types for state
- How to solve Type Property '' does not exist on type 'IntrinsicAttributes & Function'?
- How to solve Property does not exist in type 'never'
- How do I access React State properties using TypeScript? Get property does not exist on type error
- Property does not exist on type 'DetailedHTMLProps, HTMLDivElement>' with React 16
- ts(2322) Property children does not exist on type 'Intrinsic attributes and Props'
- React with Typescript: Property 'push' does not exist on type 'History'
- State using React Typescript: Property does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes
- Property 'value' does not exist on type 'HTMLElement' in React Testing Library
- react hooks and typescript - Property '***' does not exist on type 'never'
- TS2339: Property 'focus' does not exist on type '{}'. with React typescript
- Property 'auth' does not exist on type 'FirebaseApp' on REACT
- React Hooks with typescript: Property 'data' does not exist on type
- Property 'name' does not exist on type 'EventTarget' - React + TypeScript
- React: How to solve: Property 'children' does not exist on type 'IntrinsicAttributes & Props'
- TS2339: Property 'closest' does not exist on type 'EventTarget'. - How do I get native event.target in React?
- React Typescript: property 'body' does not exist type 'DefaultTheme'
- How do I fix "[ts] Property 'getAttribute' does not exist on type 'EventTarget'"
- Typescript Property '' does not exist on type 'never'. in React NodeJs stack
- forwarding ref to react.FC gives type error: Property ref does not exist on type 'IntrinsicAttributes & Props & { children :? ReactNode}
- Property 'location' does not exist on type 'Readonly<{}> - React Router and Typescript
- React Typescript property does not exist on type / IntrinsicAttributes & IntrinsicClassAttributes
- React & Typescript: Property 'id' does not exist on type 'number'
- Property 'background' does not exist on type '{}' - React Router modal
- React Typescript Custom Hooks: Property 'prop_name' does not exist on type '{}'
- TypeScript Property 'value' does not exist on type 'HTMLElement'. React Jest Testing
- React Antd Modal Property 'children' does not exist on type 'IntrinsicAttributes & ModalProps'
- React - Property does not exist on type IntrinsicAttributes
- How to set function props type for its child in Typescript? Property 'children' does not exist on type TS2339
More Query from same tag
- How to remove a specific event listener from a react.js element
- 'Paramter value' is missing in props validation react/prop-types error
- Use React fetch to call Dango REST getting a 403 response
- how to fix `Expected an assignment or function call and instead saw an expression` error in ReactJS
- Create-react-app stuck on "found 0 vulnerabilities"
- Simple logout component throws "Cannot update a component from inside the function body of a different component"
- Mobile responsive problem in reactJs navbar
- Preventing users clicking same correct answer twice in multiple choice question (ReactJS)
- How to convert array of events into HH:mm format
- How can I use React Router to change routes from within a component that is also Routed in the Main App.js component?
- Any reason for a react state hook set callback to fire twice?
- Capitalization independent react props
- How can I print these dynamic data in jsPDF?
- Design of a custom accordion
- How to disable a button from react component inherited by a child react component?
- React, Redux, React-Router?
- Acessesing Nested Objects in React render
- Set an array inside an array of objects using react hooks
- Aplication works but generates an error: mapDispatchToProps() in Connect(App) must return a plain object. Instead received undefined
- Text remains wrapped inside it's parent div - CSS, React
- How to send data from react to Controller in ASP.NET MVC?
- Material Ui Table Sort with pagination
- Change colors in scss depending on row data in React page
- Apply JavaScript to the layout in React after route is rendered
- Reactjs: Is it necessary to copy object in component state before modifying it?
- React - Using ternary to apply CSS class in functional component
- how to implement a react countdown using a single useState hook?
- Axios call gives infinite loop
- React Hooks infinite loop with Array
- TypeScript checking in React Functional components