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…
Tag: react-hooks
React – Adding props.something as a dependency of useEffect
I have this useEffect code here: But I get this warning in the terminal: React Hook useEffect has a missing dependency: ‘props’. Either include it or remove the dependency array. However, ‘props’ will change when any prop changes, so the preferred fix is to destructure the ‘props…
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…
Facing issue while updating auto increment counter value in react.js using useEffect Hook
I’m having an issue with the auto-increment counter, which updates every 2 secs. It updates the value but in a glitchy way Please check the code and share your views regarding the problem. Answer try this
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…
React hooks in dynamic lists – more hooks than previous render
Looking for an approach that allows me to use state hooks in dynamic lists of functional components. As my code stands a re-rendering of the list gives errors concerning changing numbers of hooks. I have a master component that renders a list of Functional components, the length of the list depends on the sta…
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…
React how to combine data from multiple API and render it
I need to fetch the data from the multiple API and need to render it. I have wrote the code to fetch the data from multiple API am getting the data as expected. The data I am getting is in nested array format. I can’t able to populate the data by interpolating the state. Since the data is in nested
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 …