I have started to work on a form project using React final form, but I am struggling to do a two condition question. Would anyone knows how to do a double conditional logic on React final form. From this example, the single conditional logic code is given : However, I don’t know how to do a double condi…
Tag: reactjs
react – how to test a component if it has value prop
App.js Input.js I want to use jest and react-testing-library to test for the <Input> component. But I cannot figure out how to handle the value prop. This is the test file I’ve made, but I cannot go further. The test returns failed after I run it. Codesandbox https://codesandbox.io/s/affectionate-…
react router dom pushing user before finishing action
I’m building a Reddit clone with MERN and am using redux and react in frontend So the problem is when a user tries to register it dosen’t push the user to “/login” route. This is not an issue with redux (i think) because after pressing the “register” button again with a dif…
React-Native | Generate a non-repeating (name) generator in React-Native
Hi everyone! I have a question that I hope you can help me with. I just started with React Native and I’m working on a simple name generator. I have an array with different names in it. When I click on the button, a random number is generated. This number is associated with the array’s list of nam…
restoring scroll position in react project(hooks)
I have searched a few answers regarding my issue but found one relevant. Unfortunately, it is even on the class component, so I want to restore the scroll position after navigating back on the functional component. Here I will share the source code link on Stackblitz Answer There are few issues here. First: Y…
How to destructure an Object from Array with useState in React
I need to destructure the filter Object from Array with useState in React, but I can’t get it. I tried braces, brackets, and still getting undefined. Does anyone knows how to get that values? The filter object: Console log: Answer Based on your latest screenshot of the entire component, the problem is t…
Uncomplete payload | React & Redux Toolkit
I have a big problem,maybe it’s not so big but i dont sleep for almost 24h because of it.I barely finished this Slice,but now,when i submit the data,i get only the automatically set id.. So,to be clear.I have a skill component where i have 2 input forms and a button,i need to retrieve data from both inp…
How to populate ToDo list with UseEffect Axios API call in React?
I’m trying to populate my ToDo list with all the tasks I get from my database with an API call. Unfortunately, nothing is showing up. My API call is working because the console.log(response.data) returns the 3 tasks in my database, but my view is not updating with the data that I got from my call. I get…
How to fix unique “key” prop and validateDOMNesting(…) in ReactJS with fuctional component
Hi all I have following code. Test.js component App.js component When I am rendering my Test component in App.js file I am getting errors like Warning: Each child in a list should have a unique “key” prop. Warning: validateDOMNesting(…): <div> cannot appear as a descendant of <p>…
unable to define navigate = useNavigate()
I’m trying to run this code: but somehow const navigate = useNavigate() gives me Parsing error: Unexpected token Could anyone please help me with this problem? Answer Hooks need to be called at the top level of your React functional component.