I’m creating a simple movie app with moviedb. I have successfully retrieved the most popular 20 movies and put them in the app state: I know the array was retrieved correctly because when I look at the React components in Chrome dev tools I see what I want: Screen cap of App state Then in the render par…
Tag: reactjs
Unable to pass value from input to fromData in reactjs
I am having a form using react-hook-form and I am updating the input forms using setState but when I am get formData and do a fetch request the value from the input text field is not loading at all. This is the picture when I update the input text field from setState and do a fetch request This is the
useState and useHooks in HTML
first of all, I can not use the “create-react-app” command in the current project. so here I am trying to add my react code into a plain HTML file. Here are my codes for HTML and js files. can anyone tell me why my hooks and setState don’t work properly? Please guide me to solve it. my like_…
How to properly execute logic right after setState updates the react functional component state?
Currently, I am making a profile page where it will initially fetch the user profile details from an API endpoint. I want to have a loading indicator representing the fetch status. I am now using useState hook where I store a boolean value for isLoading state. However, after reading the documentation about us…
React does not update page when manually entering a URL
I have this issue where React does not update/refresh the page when manually entering a URL on a tab that already has the website open. I have a live demo of the website here: https://dpldmuafup7cw.cloudfront.net/#/ When on the home page you should be able to click a link to a film, and then enter the ID of a…
Showing/hiding React components does not maintain internal state
I am trying to hide/show components in React based on some state. The main issue I am facing is to maintain the internal state of the components during hiding and showing. The below is the code that does what I expect and maintains the state of each of the components (Africa, Europe, America, Asia): However, …
React state update not working with setState
Okay so it’s simple I have an array of answers inside an array of questions. the user has the option to select more than one answer. When an answer is selected, the text should change to selected and unselected if it isn’t selected. These are the steps i’ve tried to update my state step 1 us…
When card is clicked, progress bar have to advance with useEffect. How can i do this?
I would like the progress bar to advance when I hit one of the three cards using useEffect so that it has animation. How can I do? Written like this gives me error on Hook rules. If there is another way without using useEffect it would be fine, the important thing is that there is animation and when I press
React | error “Objects are not valid as a React child” when trying to push to state array
I’m learning some React with a project I dreamed up that has data being passed via props and also pubsub messages. I’m passing an email address via pubsub and it comes in fine on the pubsub subscribe method, like this: The above results in a console log of test@test.com being a fake test email tha…
React “Warning: Encountered two children with the same key”
I have a React app that mapping cards and each card have unique id although I’m getting error in console that some are not unique: Warning: Encountered two children with the same key, 2294264. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause chil…