How can I use ternary operator ( ? true : false ) or something else to remove the currrent logged in user from this list?
const [users,setUsers] = useState("");
useEffect(() => {
axios.get("http://localhost:3000/api/v1/user/bulk?filter=" + filter)
.then(response => {
setUsers(response.data.user)
})
}, [filter])
// Then using it like this, to get all the users data.
{users.map(user => <User key={user._id} user={user} />)}
I have tried using this, but in terms of seperating users. I didn’t get it
2
Answers
You could more efficiently, apply the useMemo hook to remove the logged in user, rather than removing it at time of render
Try it and comment if any doubts!!