Skip to content

Instantly share code, notes, and snippets.

@darksh3ll
Created November 4, 2018 13:40
Show Gist options
  • Select an option

  • Save darksh3ll/389e2b119cf630c5d9d58e00037fdb52 to your computer and use it in GitHub Desktop.

Select an option

Save darksh3ll/389e2b119cf630c5d9d58e00037fdb52 to your computer and use it in GitHub Desktop.
afficher et filtrer un tableau
// 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