I have a state with a 4 properties. Initially, all of them will be set to false. But, when I will click the button , the particular one will change to true and it all other values will be displayed. I am trying to use filter method but I am unable to do so.
State:
state = {
hospitals: [
{ id: 'h1', name: 'Apollo Hospital', city: 'Chennai' },
{ id: 'h2', name: 'Fortis Hospital', city: 'New Delhi'},
{ id: 'h3', name: 'Tata Memorial Hospital', city: 'Mumbai'},
{ id: 'h4', name: 'Lilavati Hospital', city: 'Pune',}
],
};