Skip to content

Tag: react-hooks

filter and map in an object array

I can’t retrieve the user by his customer number. I use the includes function in filter, but this returns the error: Cannot read properties of null (reading ‘includes’) . Despite everything I’ve seen on the forum, nothing solves my problem. I have an array of user object, so I make a m…

Trigger parent API call from child in react

In my parent(Feed) I display a list of posts: The child(PostCompose) can create a post: The PostCompose component makes the requests to the backend to create the new posts, but how do I trigger the Feed to refresh to pull the new list of posts? I feel like my approach might need some work, any help would be g…

REACT- My condition is working partially why?

In my json file from my api, I have a variable apply, If apply:0, Then It should should print my data and If apply:1, Then It should hide my data (i.e row in my Table). Actually when I combine my 2 conditions, It is partially working :(applyStatus ? menus : menus.filter((i) => i.apply !== 1)) && (s…

Show and Hide Condition in React

I have a simple problem here which I can’t figure out. I wanted to hide menus depending on the condition. For example if status contains at least one “Unlinked”. “All unlinked images” menu should appear. I did used .some and I wonder why it doesn’t return a boolean. Codesan…

Compare value of two arrays

Five random numbers(from numbers array) will be shown one by one and we need to recall last four number by clicking the number. The answers are push to answer array after clicking. Now i need to compare answers array and number array to calculate the score. My problem is in scoring logic which is not working …