Category "reactjs"

Detect previous path in react router?

I am using react router. I want to detect the previous page (within the same app) from where I am coming from. I have the router in my context. But, I don't see

React.useState is changing initialValues const

I'm experiencing some odd behavior with react's useState hook. I would like to know why this is happening. I can see a few ways to sidestep this behavior, but w

React: How optimize a custom hook that shares data?

I have a Custom Hook similarly with the below: import { useEffect, useState } from 'react'; import axios from 'axios'; const myCustomHook = () => { cons

react native - requiring unknown module

I have been trying to load local image files in ListView. It does work when I hard code: return <Image source={require('./public/image1.png')} style={{wid

How to create a custom hook that recives dependencies?

I'm making a custom hook that have a toogle when some state change. You should be able to pass any state in an array. import { useState, useEffect } from 'rea

How to get state of Reactstrap's CustomInput Switch component, and how to map switches from an array?

<FormGroup> <div> {this.props.diseases.map((disease, index) => ( <FormGroup> &l

How do you simulate an keyDown enter event (or others) in Enzyme?

I'm trying to simulate a keyDown event, specifically for Enter, keyCode: 13. I've tried a number of different ways of doing this, but none of them are working.

How can I create dynamic titles in next.js <head> section?

I have a fully functioning website but the head sections doesn't retrieve page specific <title> and <meta description>. For example, if I'm on the

i tried to Polyfill modules in webpack 5 but not working (Reactjs)

Hi guys am a newbie in React when i start my project i get the Wepback V5 Error Message Resolve updated : https://github.com/facebook/create-react-app/issues/11

How to catch and handle error response 422 with Redux/Axios?

I have an action making a POST request to the server in order to update a user's password, but I'm unable to handle the error in the chained catch block. retur

Netlify renders 404 on page refresh (using React and react-router)

I have deployed my site with Netlify, and I’m having trouble with the routing. Here is my website: https://redux-co.netlify.com/ And my GitHub repo: ht

How to prefill CkEditor with data using React.js?

I'm creating a blog and I want to give the user the ability to update their post but I'm not sure how to pass the content data from the original post into my ri

Error when deploying react app and it keeps sayings << Plugin "react" was conflicted between "package.json » eslint-config-react-app » >>

I have been having a little bit of issues when deploying my create react app, as it fails to compile and tells me Plugin "react" was conflicted between "package

Invalid options object. Dev Server has been initialized using an options object that does not match the API schema

I have been stock on this error on my project when I add "proxy": "http://localhost:6000" in my package.json. This is the error response after yarn start. Inva

Clear an input field with Reactjs?

I am using a variable below. var newInput = { title: this.inputTitle.value, entry: this.inputEntry.value }; This is used by my input fields. <

Trouble with react-countup and easingfn

I'm trying to make a countuptimer (up to 2022) in React using react-countup library. https://www.npmjs.com/package/react-countup I can't get the timer to do a s

Making renderToNodeStream work with an async Helmet version

I am trying to convert my working SSR code from renderToString to renderToNodeStream, which became available in thew React.JS, for improved time-to-first-byte.

Test fails with "TypeError: theme.spacing is not a function" after migration from MUI v4 to v5

Have design system created/customized with MUI v4. Decided to update to V5 using this manual. All steps are done (with codemods and manual fixes), except moving

Buffer is not defined, after migrating from CRA(create react app) to vite

After having declared and done all the config files, when I start the server I get Buffer not defined and the error points to an npm module. Uncaught ReferenceE

Buffer is not defined, after migrating from CRA(create react app) to vite

After having declared and done all the config files, when I start the server I get Buffer not defined and the error points to an npm module. Uncaught ReferenceE