[{_id: "5f7ab0e57b4d3030cc14181b", Name: "Child Support", pic: "https://i.ibb.co/f8bBB8L/food-Charity.png", description: "Lorem ipsum", eventStarts: "20-04-2020"}, {_id: "5f7ab0e57b4d3030cc14181c", Name: "Refuge Shelter", pic: "https://i.ibb.co/7nrP5Vg/babySit.png", description: "Lorem ipsum", eventStarts: "20-01-2020"}, {_id: "5f7ab0e57b4d3030cc14181d", Name: "Food Charity", pic: "https://i.ibb.co/rmkjNyp/bird-House.png", description: "Lorem ipsum", eventStarts: "25-04-2020"}]
how can i find an array with an _id name such as "5f7ab0e57b4d3030cc14181c"?
I need to get to the name of that array... Using react and MongoDB. specificEvents = _id ... So i want to use it to find an array and get the name.
const Register = () => {
const [loggedInUser, setLoggedInUser] = useContext(UserContext);
const { specificEvent } = useParams();
const [events, setevents] = useState({})
useEffect(() => {
fetch('http://localhost:3100/events')
.then(res => res.json())
.then(data => {
setevents(data);
///////// I wanted my finding code here ///////////
})
}, [])