I use useEffect to make an api call only one time after the component is rendered. But it renders two times and I don't understand why. Thank you for your hints.
useEffect( ()=> {
// load all pipelines
console.log("getting all pipelines");
const api = new Api();
api
.get_pipelines()
.then(response =>{
getPipelines(response.data.sort((a,b) => (a.pipelineState > b.pipelineState) ? 1 : ((b.pipelineState > a.pipelineState) ? -1 : 0)))
})
.catch(error => {
console.log("error getting existing pipelines", error);
if(error.response.status === 500 || error.response.status === 404){
openBanner("Cannot load existing pipelines", "error")
}
});
}, [openBanner]);