Category "reactjs"

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, ['><',]) This will cause React to escape > 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,

update objects in array with useState (reactJS)

Go to the end of this question for the solution that worked for me! i'm currently making my own chess game and i want to check if a position already occurred 3

How to add a comma in array.map after every element except last element in React JSX

How can I add a trailing comma after every element of an array for making a list like: INV, INV, INV, INV Note that the last element doesn't have a trailing c

React project crashes with many allocation failures on Heroku but runs on local dev

My React calendar app works well on a local development build but it gives many allocation failures when it's deployed to Heroku. Here is the error from the Her

React Apollo Link - How to forward operation after a promise has resolved?

So I figured out how to setup a middleware to handle my auth tokens, as well as getting new ones, if need be. The problem is that, there is an edge case here wh

There appears to be trouble with the npm registry (returned undefined). Retrying

I'm trying to install dependencies in my project but when I run yarn install I get the following error [2/5] 🔍 Resolving packages... info There appears

How to update atoms (state) in Recoil.js outside components ? (React)

I'm new to Recoil.js, I have the following atom and selector for the signed-in user in the app: const signedInUserAtom = atom<SignedInUser | null>({ k

Embed react component into website without Iframes

my company wants to create a react component which is going to render a google maps frame, a search field and a result list. Basically to search, see results an

React: The `value` prop supplied to <select> must be a scalar value if `multiple` is false

I am getting this warning: Warning: The `value` prop supplied to <select> must be a scalar value if `multiple` is false. Check the render method of `Cont

Read Store's Initial State in Redux Reducer

Initial state in a Redux app can be set in two ways: pass it as the second argument to createStore (docs link) pass it as the first argument to your (sub-)redu

React: Where To Extend Object Prototype

I created a pure React application using create-react-app. I would like to extend the String class and use it in one or more components. For example: String.pr