Created
November 4, 2018 13:40
-
-
Save darksh3ll/389e2b119cf630c5d9d58e00037fdb52 to your computer and use it in GitHub Desktop.
afficher et filtrer un tableau
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // App.js | |
| import React, { Component } from "react"; | |
| import "./App.css"; | |
| class App extends Component { | |
| state = { | |
| scores:["jean","pierre","stephane","charlotte"] | |
| }; | |
| render() { | |
| const filter = "char"; | |
| return ( | |
| <div className="App"> | |
| { | |
| this.state.scores.filter(score => score.includes(filter)) | |
| .map(score => { | |
| return( | |
| <h1>{score}</h1> | |
| ) | |
| }) | |
| } | |
| </div> | |
| ); | |
| } | |
| } | |
| export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment