I am trying to consume my api through code I am getting this error object` (“[object Response]”) cannot be serialized as JSON But when I call or use this api through browser I am getting response. here is my code https://codesandbox.io/s/naughty-platform-1xket?file=/pages/index.js I am consuming my api like this API design I am getting this console value on server. but when
Tag: reactjs
React how to make conditionally rendered navigation persist
I am in the process of learning React and am creating a React desktop app where the side-navigation must change depending on the user’s current location (determined by standard navgation buttons in the App body). The application is accessible here: https://codesandbox.io/s/conditional-navigation-di8t5?file=/pages/Start.jsx I am able to make the navigation options render conditionally as the user moves through the app. See for
React Hooks – Updating state using props without event handlers
I’m relatively new to React and this is what I’m trying to accomplish: User selects an item from the sidebar. The elementID is lifted up to the parent(app.js). app.js sends it to its child, Graphs. Graphs will create a Graph component and append to its graph array. Is there a better way than this? P.S I’ll have more than 1x
Make page only accessible if logged in – React
Hello, please I,m a beginner in react. and I need help in knowing how to approach this challenge in the snippet above, is my homepage. my goal now is to make only explore and tour components to visible when user is logged out. so when the users visit the homepage the components will be displayed but when logged in, the
React native navigation not displaying stack screen
I’m using React Native Navigation dependency as route. But I have problem in the following code which appears to do nothing. I’m trying to create 2 screens, one is login, the other is register (later on I will add button to move between them, right now even the default screen doesn’t work). App.JS Login.JS By reading the docs that should
Web page components animation
I’m a beginner learning front end development. I’m curious to know and learn how other developers create animated component like the one in below site. https://bzx.network/ Do we have a tool that will let us create this? Where I can learn these? I couldnot find the tool, right search keyword in google, stackoverflow. Many thanks! Answer If you look using
How to call a method once a component is rendered?
I have a parent component that conditionally renders two components. Once I am done entering data in the first component, I click done and then render the second component. I want the second component to only then parse all the data I entered in the first component. Im a little confused which lifecycle method I am supposed to be using.
Sibling component not re-rerendering on state change (using useEffect, useState and Context)
In my Main.js I create a first global state with a username and a list of users I’m following. Then, both the Wall component and FollowingSidebar render the list of follows and their messages (plus the messages of the main user). So far so good. But in a nested component inside FollowingSidebar called FollowingUser I have an onClick to remove
Value from response is undefined ReactJs
I’m trying to get values from trains such as id and number, but when I try to do that, no values shows. When I try to console.log that I get response of undefined. It works well with station.name and station.city but i does not work with station.trains.is. Here is my code: And here is the response I get from API:
React Hook “useState” is called in function
I have button click system and it works. Now I want to fetch the API inside the function. So, change the function clickCreate like this However there comes error like this. I should not use useState and useEffect in function, but how can trigger the API by btn click?? Answer You should move the hook to component level (Rules of