Category "reactjs"

Modal should appear whn user navigates away from notes without saving it - react.js

I've a custom notes and Save notes button as shown in below screen shot: If the user navigates away from notes tab without saving the notes, a confirmation moda

[TypeError: (0 , react_router_dom_1.useParams) is not a function]

I have a component which uses react-router-dom's useParams hook to get params. It is used in my component as : /// Child.tsx const Child = () => { const

Display a YAML file in the UI using reactjs?

I want to display a YAML file in the UI of my component using Reactjs. const ymlText = YAML.stringify({ json1 }); ymlTxt is my YAML file, I want i

Is there a way to get npx to create a React app on my computer?

I am totally new to React and Node.js although I have written software in a variety of languages and have created web applications using Cold Fusion. I am using

How to fix my old react project not working as expected?

I'm new to react and have just added some regex validation to a jsx file in an existing react project (created about 4 months ago) . After building a new bundle

How do I have different Hero (background) on different pages

I have different CSS for every page. I already tried some tutorials, but that one Hero does not want to disappear. How do I remove that one Hero? Using React v.

FCM - web Token getting generated in my account but if i am login with some other Gmail account in chrome then it will throws Error

Other than my registered Gmail account I will be getting the below error in the chrome browser perhaps token getting generated if I log in with my email id in c

Imports not importing using Jest and Typescript

I am using Jest, Enzyme and Typescript, but for some reason certain imports are not working... they are undefined. For example, I have import ReactMarkdown from

Is this Next.JS folder structure recommended?

We have resorted to this following project structure |- pages |- <page_name> |- index.js # To do a default export of the main com

How can I add a function(Underline) on ckeditor4-react config?

React Version: 18.1.0 Ckeditor4-react tag: <CKEditor onChange={(even) => { onChangeCk(even, 'description'); }} data={formData.descript

How to toggle boolean state in React and TypeScript?

I am new to React and TypeScript. I want to toggle a boolean state (true/false) with a handler function. I've read other posts about how to do this in ES6 but

React Testing library custom setup import test-utils: module not installed. Unable to resolve path

I'm trying to configure jest absolute path for my custom test-utils directory (https://testing-library.com/docs/react-testing-library/setup#configuring-jest-wit

Import image dynamically in React component

I have an Articles component that shows a blog page with listed articles. render() { const articles = { ...this.state.articles } const art

React strict mode breaks application in development with OAuth

In my OAuth flow, the token can only be called once, then it 404's. In React strict mode, it renders my component twice, which invokes a call to my back-end. Th

MUI - How can I style the scrollbar with CSS in JS?

I really hate having to have an external stylesheet for my scrollbar stylings and I want to put it in with the rest of my styles on my root component. I have tr

getFieldDecorator rules for password to contain lower case upper case letters and numbers?

I am working on a react app and the views are built with Ant Design, I am validating a form and I don't know how to validate the password to contain chars of lo

Next.js document is not defined trying to implement locomotive-scroll

I'm trying to implement Locomotive Scroll in my Nextjs app, and I'm having trouble... Here's my code: import type { AppProps } from "next/app"; import { useEffe

Absolute path not working in Vite project React TS

I'm struggling to get absolute path to work in a Vite react-ts project. Here's how I created the project npm init @vitejs/app npx: installed 6 in 1.883s √

Restructuring the object using different name [Object manipulation]

I have a use case where I have to restructure the object. Initial I have this object { name: 'Tommy Kerar', mandatoryRequirements : [{ name:

Error: {"data": "foreach() argument must be of type array|object, string given", "message": "" in React Native

i have to send this Array object to the API when i post the API data it shows me this error: Error: {"data": "foreach() argument must be of type array|object,