Category "reactjs"

Rollup & Typescript type declarations with absolute imports

I'm making React component library. Project structure is something like: src/ components/ utils/ hooks/ Now I'm trying to generate types (.d.ts.) file

integrated google analytics in react application but blocking analytics.js by content-security-policy which is added from backend asp.net core

string script_src = $"script-src 'self' 'unsafe-eval' 'unsafe-inline';"; context.Response.Headers.Add("Content-Security-Policy", new StringValues($"default-sr

What is the difference between React Native and React?

I have started to learn React out of curiosity and wanted to know the difference between React and React Native - though could not find a sati

proxy not working for react and node

I'm having issues with the proxy I set up. This is my root package.json file: "scripts": { "client": "cd client && yarn dev-server", "server"

Why do we need middleware for async flow in Redux?

According to the docs, "Without middleware, Redux store only supports synchronous data flow". I don't understand why this is the case. Why can't the container c

Next.js error "Unhandled Runtime Error TypeError: Cannot read properties of undefined (reading 'scrollTo')"

While making a portfolio website with Next.js, this is some sort of scrolling error that I'm getting from .next folder in my project folder. Whenever I'm trying

npm run build fails after updating npm (EACCES: permission denied)

I have a CRA (create-react-app) and I updated npm. Following, npm run build started to fail with error: EACCES: permission denied, rmdir 'PATH/build/static/css

sass version is incompatible

I have problems with my code. I installed dependencies one by one, but the last of them was sass. I need or better to say I have to install node-sass version ^4

SVG sprite images not showing on iOS & Safari using React

I am trying to use my svg images with a sprite file. Importing sprite file in relevant component and using custom Svg component to render images with symbol id'

Argument of type (key: string, id: string, pagination: number) => Promise<void> is not assignable to parameter of type Boolean

Not sure what is the matter here, but I am trying to follow this documentation: https://swr.vercel.app/ with this setup of my own: import React, { useEffect } f

How to add http Headers in react js app's response

I have a react js application. I want to add some http headers in the every response that's being returned from the app. Could you please suggest how to impleme

Build react app multiple times with different environment variables

I have a development environment file .env.development and a production .env file for my React web app. The .env.development has a value REACT_APP_NAME=My Test

React JS API calls to http://localhost:8000/index.php using axios not working after npm run build

After performing npm run build on my app, I am not able to make requests to my PHP backend at port 8000. It works when I am running it via npm start, but it sud

How can I pass routes in Next.js?

I'm trying to pass routes to my Next.js app but it's returning an error, I've looked everywhere but I can't find the answer. _App.tsx import Routes from './

Is there some way to avoid HTML escaping of text children when calling React.createElement?

Consider the following call to React.createElement: React.createElement('span', null, null, ['&gt;&lt;',]) This will cause React to escape &gt; a

New React Native project with old version of react native

I am trying to create a new react native project which should utilize an older version of react-native. The result I would like would be to do something like:

React.js: How to show base64 image with ImageField of react-admin

How to show base64 image with ImageField of react-admin? I used following code but it is not work: import * as React from "react"; import { List, Datagrid, Text

Error running tests - jest.mock is not a function

I am trying to run tests using Jest, however I am getting this error: jest.mock is not a function What am I doing wrong? Here's my CodeSandbox: https://co

How can i list data from table in the database in a browser

I'm developing a web application using reactjs nodejs and mysql database. I want to list the data created in a table i created in the database in the browser

React Toggle open and close using onclick on map function

I have an onClick in map function, if I click onClick it will change state of all map item not that item which I clicked. I am using useState hook. const [open,