Using Lists (UL/OL) in ReactJs – Code Example

Total
0
Shares

In this article we are going to learn how to use unordered (UL) and ordered (OL) lists in JSX in React JS codes. Here is the example –

class ShoppingList extends React.Component {
  render() {
    return (
      <div className="shopping-list">
        <h1>Shopping List for {this.props.name}</h1>
        <ul>
          <li>Instagram</li>
          <li>WhatsApp</li>
          <li>Oculus</li>
        </ul>
      </div>
    );
  }
}

// Example usage: <ShoppingList name="Mark" />

Source: Reactjs Docs