I am building a user login system and currently the way I have it set up, the user types in their email and password and then that information is sent to my server to be checked if accurate. If it is, I create a JWT token and send it back along with the mongodb _id of the user, I then
Tag: reactjs
Passing a value from one request to another request in ReactJs
I need help because I couldn’t use a separate function to generate the token – it gives out a promise, not a value. I was told that a value can only be used inside a function. For each request, I generate a new token in the first request and then pass that token into the second request. I tried ma…
how to enable top level await in reactjs
I have installed craco using yarn add @craco/craco I have also replaced the scritps and have created a craco.config.js but when I’m trying to use await at top level I’m still getting this error in my react app Answer In the craco docs, it says you need to add a configure block to handle any webpac…
React – n of my JSON.String disappears after getting put in div
In my NFTDetails component is a description that comes out of a JSON. There are nn in it. There is no new line when I use the value of the JSON in a div, but there are new lines in the Firefox console when I console.log() it. How can I use the n to display new Lines in my div.
Change a JSON value with an MUI Switch component
I am setting the state of an MUI switch based on the response from an API. The Active field in this API response dictates whether the Switch is checked or unchecked. The switch is checked if the JSON field is 1, and un-checked if the field is 0. When I manually check or un-check the switch, I want to reflect
D3 text in alignment with rect
I have rect and a description text above chart – Issue is description text is not getting properly aligned with rects. Description is getting mixed into rects. I want to start text after rect ends. I have below code – HTML getting generated for color rect and description text – How can I avo…
React how to combine data from multiple API and render it
I need to fetch the data from the multiple API and need to render it. I have wrote the code to fetch the data from multiple API am getting the data as expected. The data I am getting is in nested array format. I can’t able to populate the data by interpolating the state. Since the data is in nested
Compare value of two arrays
Five random numbers(from numbers array) will be shown one by one and we need to recall last four number by clicking the number. The answers are push to answer array after clicking. Now i need to compare answers array and number array to calculate the score. My problem is in scoring logic which is not working …
Tailwind animation plays twice when changing pages in Next.js?
I’m using react-hot-toast to show alerts & animate it while changing pages. The animation plays fades in twice when page changes. I’m using tailwindcss-animate in my tailwind.config.js to add animation classes. I’m only using 4 animation classes: animate-in, animate-out, fade-in, & f…
Converting a class to a function
I need to convert the given class component into a functional one. I’m working with outputting an array of multiple Editors draft-js and I’m having some trouble outputting them. On the internet, I found a working class component with an array of them, but I can’t convert it into a functional…