Answers for "react item list"

1

react item list

function NumberList(props) {
  const numbers = props.numbers;
  const listItems = numbers.map((number) =>
    <li>{number}</li>
  );
  return (
    <ul>{listItems}</ul>
  );
}

const numbers = [1, 2, 3, 4, 5];
ReactDOM.render(
  <NumberList numbers={numbers} />,
  document.getElementById('root')
);
Posted by: Guest on October-22-2021
0

react list

const todoItems = todos.map((todo) =>
  <li key={todo.id}>    {todo.text}
  </li>
);
Posted by: Guest on October-16-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language