Simon Breton Simon Breton - 2 months ago 6
Javascript Question

How should I pass my prop to get a valid Array[Object]

I'm trying to use react-json-table to build a simple data table in a react/redux project. When I'm passing the data directly inside my component, everything is working fine. However when I'm using

the table doesn't show up.

So here is my code when I'm hard coding the data :

var data = [{'alpha': 82, 'bravo': 20, 'charlie': 68}];
<JsonTable rows={ data } />

It's working fine.

But when I'm passing the exact same data through my prop directly like this
<JsonTable rows={ props } />
it doesn't work. I've check my props with a
, it's working fine.

any idea ? Do I need to format my prop in a specific way before using it ?



Be sure that you are passing the data as an array in the props to this component:

<JsonTable rows={[props]}/>