Relative Content

Tag Archive for javascriptreactjsaxios

2 Api Calls on Page Refresh React

I am working on a project where i am stuck on a issue where api being called twice without react.strictmode .
I make a layout(dashboard) which calls an /userdata api and set required states for it . Inside dashboard a child(outlet) component also have an api for /tabledata . when i am on child component and refresh the page it cause 2 apis calls /table data

The result of an onClick function appearing only after reloading the app (React.js)

I’m making my first react app, a to-do list. Everything seems quite fine, the only problem I have is that the delete and complete buttons only work after refreshing a page. Well, actually they work pretty well and as they should (I mean, I can see the console.log results in the console after clicking a button), but the front-end results I can only see after refreshing my app. I really don’t know what’s going on. Here’s the code (it’s pretty long, but I don’t know where the issue lies, so I’m showing all of it):