Skip to content
Advertisement

Tag: reactjs

How to make this code compatible for react-router v6

In ProtectedRoute.js I have coded: and in App.js I have written as: Error says: [ProtectedRoute] is not a Route component. All component children of Routes must be a Route or <React.Fragment>. Is there something missing! Thank you Answer In react-router-dom custom route components are no longer used. Routes components can have only Route and React.Fragment components as children, and Route

How to post a form with fetching?

I am trying to send a post with fetch an API. My fetch is working because it returns 200 and sends the request but it sends an empty form. It cannot take the values in the form input. Where is my mistake and how can I fix it? Answer [Update]: You can either remove the application/json header and let browser

Custom Audio Player in react JS – Volume Control

I am building an custom audio player in React JS, I am current stuck with the volume controls in the audio player Here is my code Progress bar works fine, What should be logic behind the volume control AduioPlayer.js changeRange function : changePlayerCurrentTime function : Answer Audio HTML Elements have a volume property you can access. You will need to

how can i use Route without getting any errors like this

Guys i’m trying to work on my navigation bar and use route but it always shows errors I don’t know the reason but it isn’t convinced with the routes at all and the error is below is my app.jsx code and my navigation is this code as well though i was working navlink and yet it didn’t work and showed

Server Error ReferenceError: window is not defined in Next.js

I’m trying to integrate CleverTap into my Next.js app. Followed the documentation Web SDK Quick Start Guide but facing issue: Server Error ReferenceError: window is not defined in Next.js _app.tsx cleverTapHelper.ts cleverTap.d.ts Window object should not be undefined but getting undefined! What’s going on? Answer This is because NextJS is trying to execute that function on the server because it

Advertisement