Skip to content
Advertisement

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 map on the array and then I filter here

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 great as

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)) && (showGood ? menus :

react js : children style doesn’t show

I tried to create a component ‘Card’ and use it like a container. the code work well without ‘card’. when I tried to add it the ‘Card.css’ and expense-item in ExpenseItem.css doesn’t work this is ‘ExpenseItem.js’: this is ‘Card.js’: and this is ‘Card.css’: and finally this is ‘ExpenseItem.css’: Answer You need a space between card and the class name in

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. Codesandbox is here Click here Answer The methods do return a boolean.

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 as expected. When the

Advertisement