SHARE
TWEET

Untitled

lezzles11 Jun 25th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const App = () => {
  2.     const courses = [
  3.       {
  4.         name: 'Half Stack application development',
  5.         id: 1,
  6.         parts: [
  7.           {
  8.             name: 'Fundamentals of React',
  9.             exercises: 10,
  10.             id: 1
  11.           },
  12.           {
  13.             name: 'Using props to pass data',
  14.             exercises: 7,
  15.             id: 2
  16.           },
  17.           {
  18.             name: 'State of a component',
  19.             exercises: 14,
  20.             id: 3
  21.           },
  22.           {
  23.             name: 'Redux',
  24.             exercises: 11,
  25.             id: 4
  26.           }
  27.         ]
  28.       },
  29.       {
  30.         name: 'Node.js',
  31.         id: 2,
  32.         parts: [
  33.           {
  34.             name: 'Routing',
  35.             exercises: 3,
  36.             id: 1
  37.           },
  38.           {
  39.             name: 'Middlewares',
  40.             exercises: 7,
  41.             id: 2
  42.           }
  43.         ]
  44.       }
  45.     ]
  46.     const Fam = ({ fam }) => {
  47.       return (
  48.         <li>{fam.name}</li>
  49.       )
  50.     }
  51.     const Apps2 = ({ courses }) => {
  52.       const rows2 = () => courses.map(course =>
  53.         <Fam key={course.id} name={name}/> )
  54.         return (
  55.           <div>
  56.             <h1> Notes</h1>
  57.             <ul> {rows2()} </ul>
  58.           </div>
  59.         )
  60.     }
  61.     const result = courses.map(course => course.id)
  62.     const rows = courses.map(course =>
  63.     <li key={course.id}> {course.name} </li>
  64.     )
  65.     return (
  66.       <div>
  67.         {result}{rows}
  68.       </div>
  69.     )
  70.   }
  71. ReactDOM.render(<Apps2 />,
  72. document.getElementById('root'))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top