I am trying to make a menu with three accordion windows. All of the data is being stored within the functional components using arrays, my aim is to trigger the opening of individual windows separately using the Active States. This is my code so far: As you can see with the code above I have a simple activeItem state, the
Tag: react-hooks
React Hooks Form : undefined values on submit
I took the example from the documentation : But on every change or on submit, I got undefined for each field I tried to install the library again but nothing change and I got undefined everywhere…seems to be a problem with the register function. Does anybody got the same issue ? Answer With v7 the usage of register changed as
React toggle button only works once?
I am learning React Reducer now. I want to build a toggle button that changes a boolean completed value to its opposite each time I click the button. What I have is an array of states, each state is an object with an id and a completed value set to be true or false. Then I loop through states, setting
not able to update state in reactsJs
i am using table input field to update state under map function to render it according to number of elements in the state.But when I used value={item.account} values are not updated in the state.which works fine when I use **value={accountCounter.account} where accountCounter is reactjs hook of type And here is my rendering function here is my handleAccountCounter But the state
Trouble on adding items to Flatlist, React Native
DIET (screen) FOODCREATE (screen) Hello everyone, I’m trying to make an app in which the user has to insert foodName and calories in the FoodCreate screen and once he taps the checkmark it will add the foodName and calories to the Flatlist in the Diet screen (when I launch Expo the first screen to appear is the Diet screen). When
React useState causes if-else to work incorrectly
So I am trying to set a value using a useState hook (React JS) in an if-else conditional statement. I need to check whether there is addOnName (which is passed as a parameter), in the addOnContainer array and if it does, I need to deduct the addOnPrice (which is also passed as a parameter) to the totalprice using the setTotalPrice
scroll to the top of page in reactjs
I am designing the registration page in Reactjs .and I am doing manual validation. now what I want is after clicking onSubmit, the page should scroll to the top to show all errors in the validation.I tried but failed to achieve this.is there anyone who will help me Answer If you task is to scroll to errors rather than scrolling
Why Initial states are undefined in react native?
Hy! I’m a newbie in react native. Recently I developed an expo app that is working properly but there is an issue I’m facing with my login screen is that when I put username and password press login button on the first attempt when I console log the states in which data are set with AsyncStorage which help me to
How do you filter JSON data using axios and useEffect?
I want to filter the data from this json file: How can I use axios and React Hooks to filter this data and only get the state name and their actuals as variables to pass in a search UI later? This is my code currently: Answer I’d note that there probably isn’t a reason to try to get rid of
Weird error in react – using apollo/client – graphql
I’m developing a MERNG App, and everything is working fine so far, but i’m getting some errors in the fronted with useMutations, let me explain to you. So, in the login/register part, if you leave fields empty or in the login, if your user is not found in the DB, it’ll give errors, and i receive those errors in the