react-dom Questions

2

First of all here is my code in react import { useFormState, useFormStatus } from 'react-dom' import { submitAction } from './action.ts' export default function Calculator() { const [result, subm...
Mantelletta asked 14/1 at 18:0

3

I am facing some errors while rendering at SSR for some URL using renderToString from "react-dom/server" I am getting following error: TypeError: Cannot read property 'length' of undefine...

4

I was trying the Next 13 beta version, and I faced a strange problem. What I am trying to do is, fetch data on the server side and display them on the page. However, the "fetch" operation...
Nierman asked 13/12, 2022 at 3:31

24

Solved

I have a React Typescript application that won't compile. Many components have a render method that is typed to return React.ReactNode or React.ReactElement. On compile, many errors similar to the ...
Trestle asked 11/4, 2022 at 16:55

5

I have React Component in componentDidMount fetch data from the server. The issue is componentDidMount called twice also the API called twice. I have a view increment API like youtube video views i...
Chariot asked 12/8, 2020 at 19:25

3

On this repo: https://github.com/tlg-265/react-app-vanilla $ git clone https://github.com/tlg-265/react-app-vanilla $ cd react-app-vanilla $ yarn $ yarn start I have a dummy app with just 3 pages:...

3

Solved

For my app, I need to render some children, and then measure the resulting div. In pseudo code, it would look something like this: function getDims(child) { var testEl = document.getElementById('...
Whereabouts asked 29/10, 2016 at 12:27

0

I was trying to use the renderToString function as some libraries such as leaflet require it to make custom markers. Below is a simple example that recreates the error in a fresh React project: imp...
Melmon asked 12/2 at 1:16

4

Solved

According to the react unit testing documentation: act() To prepare a component for assertions, wrap the code rendering it and performing updates inside an act() call. This makes your test ...
Weaks asked 7/2, 2020 at 12:13

2

Solved

I'm trying server-side rendering for the first time in my React/Redux app. An issue I'm having right now is that I need the initial state to have a randomly generated string and then pass it as a p...

11

Solved

I have index.html <body> <div id="portal"></div> <div id="root"></div> </body> and want to use the component below in separate portal div ...
Subtilize asked 21/8, 2020 at 10:0

3

In my application, I want to determine the current scroll position, so I have been using this to do so (source: https://www.codegrepper.com/code-examples/javascript/get+current+scroll+position+java...
Kicker asked 7/6, 2022 at 18:26

3

Solved

Consider the following example: class GridContainer extends React.Component { ... render (){ return <div> <Pagination portalId="portal-id"></> <Grid ...> &l...
Isabelleisac asked 27/12, 2018 at 19:30

3

Solved

I am making a To-do app using the Context API in React. On starting the deveopment server, it throws the error : TypeError: react__WEBPACK_IMPORTED_MODULE_0___default(...) is not a function I am...
Timmytimocracy asked 23/4, 2020 at 13:39

11

Solved

I am using react with the following packages: { "name": "demo", "version": "0.1.0", "private": true, "dependencies": { "@testin...
Billposter asked 18/4, 2022 at 15:19

0

I set up webpack analyzer to take a look at my bundle size and I've noticed that react-dom is included twice. Does anyone know why that is and how to fix it? also here is my package.json: { &quot...
Bonney asked 16/6, 2023 at 18:12

3

Solved

After updating to React 18 or creating a new React 18 app from create-react-app, when I run the yarn test command, it gives a console.error as a Warning for each of the render methods used in any o...

7

The Error: TypeError: __WEBPACK_IMPORTED_MODULE_1_react_dom___default.a.createPortal is not a function Modal.js:14 11 | 12 | 13 | function Modal(props) { > 14 | return ReactDOM.createPort...
Addle asked 9/3, 2020 at 9:29

6

I am getting above error in my react project when chrome version is updated to 74 (latest version).
Gwendolin asked 26/4, 2019 at 11:54

25

Solved

This is an example from the Google AdSense application page. The loading screen is displayed before the main page is shown. I am not sure how to achieve the same effect with React because if I ren...
Hesperian asked 6/12, 2016 at 3:23

4

Why is an external script for type="text/babel" not working in ReactJS? I put the index.html and foo.js in the same folder. Nothing show after I open the index.html file with Google Chrom...
Shrewmouse asked 25/3, 2021 at 5:32

6

My React Component is rendering twice. So, I decided to do a line-by-line debug, and the problem is here: if ( workInProgress.mode & StrictMode) { instance.render(); } React-dom.development...
Elastance asked 16/4, 2020 at 15:44

3

Solved

I saw Dan Abramov's demo project at JSConf Iceland, but I didn't understand why he used flushSync in this code: import { flushSync } from 'react-dom'; debouncedHandleChange = _.debounce(value =&...
Pl asked 4/7, 2020 at 6:10

1

How to remove this Warning: React does not recognize the showLabel prop on a DOM element. Warning message showing on console log. Warning: React does not recognize the `showLabel` prop on a...
Transmissible asked 21/12, 2022 at 19:45

1

Solved

I have a rare usecase where I need to register multiple roots in my React Component and destroy them when the component unmounts. Obviously, it happens that I unmount a root when its rendering. I s...
Christmastide asked 23/8, 2022 at 13:13

© 2022 - 2024 — McMap. All rights reserved.