Answers for "react js loop through array of objects"

0

react js loop through array of objects

var links = [
  { endpoint: '/america' },
  { endpoint: '/canada' },
  { endpoint: '/norway' },
  { endpoint: '/bahamas' }
];

class Navigation extends React.Component {
  render() {
    const listItems = links.map((link) =>
        <li key={link.endpoint}>{link.endpoint}</li> 
    );
    return (
      <div className="navigation">
        <ul>
          {listItems}
        </ul>
      </div>
    );
}
Posted by: Guest on October-04-2021

Code answers related to "react js loop through array of objects"

Code answers related to "Javascript"

Browse Popular Code Answers by Language