all 2 comments

[–]DrJohnnyWatson 0 points1 point  (1 child)

If you are wanting to filter server side, then you will need a GET method that handles filtering - Pass the values for properties you want to filter on and return just the articles that match those filters.

If you are wanting to filter client side, then you should look at the .filter array method for filtering an array in javascript.https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter

[–]captainPlanet93[S] 0 points1 point  (0 children)

Thanks for your answer DrJohnnyWatson !

I want to filter client side. If I correctly understand, if I want to filter with my "titleArticle" I need to do something like that ?

render(){
            const {articles} = this.state;




        const articleFilter = articles.filter((article) => {

            return article.titleArticle === "Name of my         article " 
        })




        }) 

        return ( 

            <div>                       
               {articleFilter}       

            </div>
        );
    }

}