DEV Community

Ralph Virtucio
Ralph Virtucio

Posted on

How will I use my props array in react? Do you have a example for forEach() Thank!

Top comments (2)

Collapse
 
pengeszikra profile image
Peter Vivo

props is object, try to debug this one:

import React from 'react';
import {render} from 'react-dom';

const DebugProps = props => <pre>{JSON.stringify(props, null, 2)}</pre>;

render ( 
  <main>
   <DebugProps foo={[2,3,4]} />
   <hr />
   <DebugProps>2-3-4</DebugProps>
  </main>
  , document.body
)
Collapse
 
ralphvirtucio_ profile image
Ralph Virtucio

Thanks I'll try !