diff --git a/src/App.js b/src/App.js
index ab4f371..f6b9c0d 100644
--- a/src/App.js
+++ b/src/App.js
@@ -9,13 +9,25 @@ import Status from "./components/Status";
import Mentor from "./components/Mentor";
class App extends Component {
+
+ constructor(props) {
+ super(props);
+ this.state = {
+ search: '',
+ }
+ }
+
+ search = (val) => {
+ this.setState({ search: val });
+ }
+
render() {
return (
@@ -42,8 +52,8 @@ class Header extends Component {
About
-
diff --git a/src/components/Mentor.js b/src/components/Mentor.js
index 9df2e39..935fc5d 100644
--- a/src/components/Mentor.js
+++ b/src/components/Mentor.js
@@ -36,6 +36,13 @@ class Mentor extends Component {
});*/
}
+ getSearchedProducts() {
+ const { search } = this.props;
+ return search ? this.state.Product.filter(
+ (data) => data.name.toLowerCase().indexOf(search.toLowerCase()) !== -1
+ ) : this.state.Product;
+ }
+
render() {
return (
@@ -43,7 +50,7 @@ class Mentor extends Component {
- {this.state.Product.map((data) => {
+ {this.getSearchedProducts().map((data) => {
return
})}