Create new React Component (chartpage) on click

I’m really new to react.js and still practising

I wanted to render a ReChart component as a new page when the user selects a row in a table (Just to visualise the Data).

I tried something like this:

(had to insert here a semicolon cause the tag was not shown)

`handleRowSelection(selectedRows) {
  console.log('selectedRows: ' + selectedRows );
  var myChart = React.createClass({
  render(){
  return(
  <;MyChart value={selectedRows}>
  )
  }
  }) 
  }`

`export default class MyChart extends React.Component {
 constructor(props){``
  super(props);
  }
  render(){
  //must be generic
  return(
  <LineChart
  data={this.props.value}
  margin={{ top: 40, right: 40, bottom: 20, left: 20 }}>
  <CartesianGrid vertical={false} />
  <XAxis dataKey="id" label="myDataChart" />
  <YAxis domain={['auto', 'auto']} label="attribute" />
  <Tooltip />
  <Line dataKey="attribute" stroke="#3f51b5" dot={false} />
  </LineChart>
  )
};`

Unfortunately it didnt help. Any Guesses here?

Thank you in advance!


Source: stackoverflow-javascript