I have looked at the previous questions and googled for the answer and I think I almost know what the issue in here is, but don’t know how to solve it. Please tell me how to setup the topar and slidebar components here. Requesting my fellow coders to look at this one and thanks in advance. Answer The er…
Tag: reactjs
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…
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…
Search input loses focus when it doesn’t find any title
Whenever I try to search, I can type only the letters which are similar to the one of the titles. If any letter is different I lose focus from input. It used to work normally before, but Idk what happened now. Any suggestions? How it first looks like: After starting to type on search input: When I type a lett…
Sorting an Objects keys/values by an array of objects the object is created from
So im generating a form for users of my application to fill out from an array of objects, each object has its own validation data….etc. This issue is when the user fills out the form and a new object is created from it to send to the back end, if the user fills out the form in order, the object
React – setting value for all array of objects
I’m creating a simple tracker that has a state checking if the button is either false (not checked) or true (checked). The structure of my data is something like this: I tried creating a function that resets all of the check values back to false. The user can delete a character or add more so I need to …
how can I prevent extra background operations when I change an state in react?
Introducing Code I attempted to write an Exercising code by React which illustrates a bus and its seats. The seats that are reserved, are unselectable and red. The rest of the seats are selectable by clicking on them and choosing a gender at an opened popup. You can see and try it here. The Problem Everything…
Add ternary operator instead condition
I would like to add a ternary operator to this code. I’ll explain why: I don’t need to check > 0 manually because any length more than 0 will be true Answer The code below uses ternary:
Calling API every 20 Seconds and Stop on a Specific Response
I want to call my API every 20 seconds from the moment where the component is rendered and the api calling has to stop when it provides a specific response. Explaining more. There is an API get method which will send a response like below. {firstWork : ‘Success’ , SecondWork : ‘Success’…
‘splice’ instead of ‘filter’
I have a field for entering tags. It is also possible to remove tags. And here I have a question. My deletion code is below. Tags can be deleted one at a time, in any order (first, last, somewhere in the middle, it doesn’t matter). But I would like to use ‘splice’ instead of ‘filter…