Questions tagged [react-dom]

React package for working with the DOM.

npm install react react-dom

This package serves as the entry point of the DOM-related rendering paths. It is intended to be paired with the isomorphic React, which will be shipped as react to npm.

Usage

In the browser

var React = require('react');
var ReactDOM = require('react-dom');
 
class MyComponent extends React.Component {
  render() {
    return <div>Hello World</div>;
  }
}
 
ReactDOM.render(<MyComponent />, node);

On the server

var React = require('react');
var ReactDOMServer = require('react-dom/server');
 
class MyComponent extends React.Component {
  render() {
    return <div>Hello World</div>;
  }
}
 
ReactDOMServer.renderToString(<MyComponent />);
1131 questions
0
votes
0 answers

Uncaught Invariant Violation: findDOMNode was called on an unmounted component

Admin Dashboard Setup: // React modules import React, { Component } from 'react'; import { connect } from 'react-redux'; import { browserHistory } from 'react-router'; import { progressDone } from 'utils/nprogress-func'; // Admin Header…
shet_tayyy
  • 5,366
  • 11
  • 44
  • 82
0
votes
1 answer

ReactServer#RenderToString not rendering correctly

I'm trying to accomplish server side rendering with React components in Express and templating with Jade. However I'm running into some issues. Here is my server code, the entry point. var app = require('express')(); var http =…
user3200167
0
votes
2 answers

How to get the DOM node of a child

I want to access the DOM node of a child component defined in a parent component. In the sample below I've tried both the "try1" and "try2" methods and neither works. How do I get the DOM node for the "theDiv" ref?
0
votes
1 answer

React: map children of ReactDOM.findDOMNode(this)

I want to get the children of ReactDOM.findDOMNode(this) so that I can style based on refs. specifically display none one some refs and yes on others. I thought I could blockNode = ReactDOM.findDOMNode(this).children React.Children.map(blockNode,…
mibbit
  • 4,997
  • 3
  • 26
  • 34
0
votes
0 answers

React is undefined after import

While trying to kickstart my app I'm getting that both React or ReactDOM are undefined. This is when using the es2015 import syntax, preprocessed with babel. Using the regular require it loads fine. The snippet is like this: import $ from…
tutuca
  • 3,444
  • 6
  • 32
  • 54
0
votes
1 answer

Capturing React Diffs and patching them manually

Does React/react-dom have the ability to let users manually compare two doms, get the diff, and apply the diff to the dom manually? As it happens now, it seems like the process of diffing and patching is done internally but I am hoping to do it…
goofiw
  • 607
  • 5
  • 16
0
votes
0 answers

Server rendering syntax for react-dom?

Using the server rendering examples for react-dom causes syntax errors related to JSX: renderToString(; ^ SyntaxError: Unexpected token < I am trying to use this in my Koa…
Pori
  • 696
  • 3
  • 7
  • 18
-1
votes
0 answers

Prevent reloading the whole page in React

I changed the parameter in a link (Eg. localhost:3000/home/id, id is the parameter here), but now I want the whole page not to reload, only the parameter where the change has happened should reload, and the rest of the things should stay intact. Is…
-1
votes
0 answers

React DOM Router with CDN throws "Cannot read properties of undefined (reading 'createBrowserHistory')"

I'm trying to write an HTML page that loads React and other relevant JavaScript code through CDN and do some client-side routing with it (the goal is to have a one file mini website). However, when I open the page and go to Chrome's console, this is…
Momonga
  • 1,843
  • 2
  • 15
  • 13
-1
votes
2 answers

React Router Typescript is "joining" several html pages and their css completely breaking my application

import { BrowserRouter, Route, Routes } from "react-router-dom"; import PacientsPage from "../components/mainPage/pacientesPage/pacietspage"; import Mainpage from "../components/mainPage/mainpage"; import BedsPage from…
-1
votes
1 answer

What is the purpose of reactDOM in reactjs

Explanation: why reactjs use virtual Dom concept, how does it different from orginal Dom. Explain with suitable example . Also explain how react Dom render jsx components How react virtual Dom works explain in a simple words .
-1
votes
1 answer

Is it possible to create mui Dialog without jsx ,just using JavaScript , mui Dialog and react/reactDom?

I wanted to create mui Dialog just using mui-core , react , reactDom without jsx syntax, wanted to created dialog
kum
  • 9
  • 1
-1
votes
1 answer

I am getting this error i dont know why "'Switch' (imported as 'Switch') was not found in 'react-router-dom'"

Even though I used Routes instead of switch still its showing the same error ,I installed react dom using the command npm install -S react-router-dom. The code is below import './App.css'; import Header from './Header'; import Home from…
-1
votes
1 answer

React: how to make a function work with a variable "getElementById"?

This is my first question here so I will try to explain what I'm trying to do the best I can. Basicly I have a function the changes the style of an image, but I have 2 images and i didnt want to create 2 different functions for it, i wanted to…
WannaJoin
  • 13
  • 1
-1
votes
2 answers

I have react app version 18 and i want install react-router dom version 5

when i install react-router dom version 5 error appers. I assume the error is caused by my react version, what can I do to fix it? $ npm install react-router-dom@5.3.0 npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm…
Amit Amar
  • 51
  • 1
  • 8