Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- listFilter = () => {
- let newList = [];
- let search = this.state.search;
- let list = this.state.filteredStudents;
- if (this.state.search !== "") {
- for (let i = 0; i > list.length; i++) {
- let checkFirst = list[i].firstName.includes(search);
- let checkLast = list[i].lastName.includes(search);
- if (checkFirst === true || checkLast === true) {
- console.log("this is list i : " + list[i]);
- }
- }
- this.setState({ filteredStudents: newList });
- } else {
- let resetStudents = this.state.students;
- this.setState({ filteredStudents: resetStudents });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement