Português:
O tipo '{ data: undefined; }' não pode ser atribuído ao tipo 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly & Readonly<{ children?: ReactNode; }>'. A propriedade 'data' não existe no tipo 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly & Readonly<{ children?: ReactNode; }>'.ts(2322)
Inglês:
Type '{ data: undefined; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly & Readonly<{ children?: ReactNode; }>'. Property 'data' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly & Readonly<{ children?: ReactNode; }>'. TS2322
App.tsx:
import React, {Component} from 'react'
import Graph from './components/Graph'
interface Props{}
export default class App extends Component<Props>{
state = {
data: undefined
}
render(){return(
<Graph data={this.state.data}/>
)}
}
Graph.tsx:
import React, {PureComponent} from 'react'
import {LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend} from 'recharts'
interface Props{}
export default class Graph extends PureComponent<Props>{
render(){return(
<LineChart width={1000} height={600} data={this.props.data} margin={{top: 5, right: 30, left: 20, bottom: 5}}>
<CartesianGrid strokeDasharray='3 3'/>
<XAxis dataKey='timestamp'/>
<YAxis/>
<Tooltip/>
<Legend/>
<Line type='monotone' dataKey='ping' stroke='#8884d8' activeDot={{r: 8}}/>
</LineChart>
)}
}
Não estou conseguindo passar o state data
para o Component Graph
via props. Alguma solução?