Category "reactjs"

How to enable import assertions for Babel?

In my React app I want to use import assertion: import data from "./json/clients-m.json" assert { type: "json" } However, I get the following error: ERROR in

React-admin keep form data after create view submit

In a react-admin Create form, is there a way to keep whatever info the user typed into the form to stay on the screen after the user clicks Save? I want to re-u

Can't stringify an array-of-objects variable in react project

As you can see in the picture, steppedJobDataState is not empty. But x = stringified steppedJobDataState, and yet logging that shows an empty set of arrays. I'm

How can I 'not allow' the user to retrieve same information from the server multiple times in my 'React' Weather-app?

I'm learning React and as a practice I'm building a weather-app. My App Photo Everything is ok. but I want When a User type a City name for example 'London' and

ASP.NET Core Web API CORS error on Firefox but okay on Chrome

I have a React and ASP.NET Core 2.2 SPA that has a CORS issue with Firefox but is okay in Chrome and Edge. I've created a little test rig that consists of the A

Error in my react app file - module not found can't resolve

Error: Compiled with problems:X ERROR in ./src/App.js 8:0-63 Module not found: Error: Can't resolve '.src/components/NewsCards/NewsCards.js' in '/Users/admin/

Type 'Dispatch<SetStateAction<any[]>>' is not assignable to type '(values?: string) => void'

I'm very new to typescipt and trying to make a basic pin-input page. Sandbox link for my code . Although it is working, I'm getting this error for onChange func

Dynamically adjust ImageList columns based on screen size?

I've tried using ImageList component instead of Grid as I just need a grid of photos with titles and it seems to be the whole point of ImageList. My issue is th

How to apply createEntityAdapter to createApi slice

I have implemented successfully a redux-toolkit api. Now Im trying to use createEntityAdapter to be able to use the pre-built selector methods. import { creat

material-ui v4.0.1 warning "Expected an element that can hold a ref"

I upgraded to material-ui v4.0.1 and I see that Modals now require a forwarded ref. I'm having some trouble implementing a fix for this using class components a

Ant design - How do i auto close select ("tags" or "multiple" mode) dropdown after each selection?

I'm using ant.design select component ("tags" or "multiple" mode) in a page, i want dropdown to be automatically closes after each selection. Now it remains ope

API Platform / React - uploading file not working

I'm trying to send an image to my API with React using a formData and Axios but my request in my custom controller shows null. When I use PostMan my api accepts

How to change route without re-rendering in Next.js?

I created a filter that when I clicked confirmed button changes url. For example, When I clicked page 1 and place type guesthouse in paris, url looks like this

How to test CSS properties defined inside a class with react testing library

I am trying to test CSS properties that i have defined inside a class in css, wing the react testing library. However I am unable to do so. Adding the simplifie

Is there a way to overcome 401 unauthorized error in React, while trying to access data from Rapidapi.com?

I am facing the problem of unauthorized 401. Done everything mentally possible, so posting it here with code and result pics. The data when accessed like this r

React Router works only after refreshing the page

I am a bit new to react and I am facing a problem with the Router. The routing works when I enter the URL directly on the browser, however when I click on the l

Suprisingly can't find a solution to this. react-csv automatically download to server instead of user choice

so I'm generating an invoice, and am using the react-csv package to covert my graphql data into a csv file. problem is I don't want the user to select a locatio

FontAwesome spinner won't spin in React

I created a React application with npx create-react-app. Then following these instructions https://fontawesome.com/how-to-use/on-the-web/using-with/react I inst

Any possible way for export two ag-grids data to a single excel file?

I have two ag-grids one beneath the other in the same page. Using the ag-grid export option, I can export them separately. But I am looking for any possible way

useswr crashes react component

After adding an SWR data fetch to my react component it crashes, if I comment it out it works fine. I get the following error after uncommenting line const { da