Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 6 months ago. Improve this question
Tag: react-hooks
React component not rendering at all
Here’s the code: I’ve been trying to learn React using this online MOOC. I’m on exercise 2.12* Data for countries, step1 and I’m stuck. My search is running fine but I’m unable to solve the last part of the problem: printing information of a selected country or if only 1 country matches the search string. I tried debugging through console.log
React native, the useEffect on a object state not working
Here is the code before the render So the state of HHDays stays null and the render shows an error on the frist {HHDays.allWeek.from} TypeError: null is not an object (evaluating ‘HHDays.allWeek’) Answer useEffect is called after the component was rendered. So when the code reaches that line the first time around, it tries to read null.from. Maybe you’d want
Nested Navigation in React Native not compiling
I’m new to nested navigation. I have tried to follow the principles here – however I am getting the error Couldn’t find a navigation object. Is your component inside NavigationContainer? I have brought the ‘Screens’ into the main App.js for ease of debugging and sharing code. Below is my code. I am trying to have a home screen with a
I’m having trouble figuring out the logic in my custom hook
Basically, as you can see in the code, I only want to run one of these API requests. If origCompId is passed, it runs duplicateInstance, otherwise, it runs addNewInstance. origCompId is a query parameter so it takes a second for it to update. This causes addNewInstance to run because origCompId begins as null. I feel like the logic is simple
How to make child components use map() from App.js props data?
My react is 18.2. I want the child component to receive data and use map() from App.js. I checked the child component received the data, but I don’t know why does it can’t use map(). It shows this error. Uncaught TypeError: Cannot read properties of undefined (reading ‘map’) So do anyone can fix it? I guess this is render problem,
How can validate and send react form data to fire base data base?
I try it but not working Here what I pass in body? There are many fields in my form but here I show some That is code which I try but it not working anybody review it and give your valuable comments and suggestions Basically I want form validation using react hook form,its done but when I stuck in passing
How to check if an email address is written more than once or not
I am using a map in javascript and using the logic if the number of fields is more than the map size then any of the mail addresses are repeated. The problem arises as the map takes empty and undefined values, thus giving the wrong output. Suppose I keep 1st and 2nd fields empty then undefined is the map, showing
How to render only new items in a react list and not re render the whole list
My problem is when I have more than one object in the state every item of the list re-renders and they each have a deletion timeout (I want them to be deleted after an amount of time) which is reset at each re-render. I tried to use React.memo() and React.useCallback() to prevent the item in the list to re-render when
React Redux createAsyncThunk actions don’t update the state
I’m implementing a registration page to my nodejs api. With createAsyncThunk I implemented the function to fetch the user data and update the state. The api works correctly, in fact it returns the created user data in the payload when the action is dispatched. But the user state is not updated and stays the initial state. Here the user slice