JSX.js

import React, { Component } from 'react'; class RepeatComponent extends Component { constructor(props) { super(props); this.state = { lenguajes: ['Javascript', 'JSX', 'Typescript', 'NodeJS'] } } render() { return ( <ul> {this.state.lenguajes.map(item => <li>{item}</li>)} </ul> ); } } export default RepeatComponent;
Let's start by creating a simple repetition, without worrying about the keys yet. For this we are going to need a component that has a property or state with an array value. In the render () method we will do the repetition in that array, creating a list element for each item of the array.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.