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
-1
votes
1 answer

How can i use ReactDOM and react imports

I'm not using CDN links. I'm using imports instead so I don't know if it really works without CDN links. here is my app.js file it's so simple but it's not working. import React from 'react'; import * as ReactDOM from 'react-dom'; const root =…
-1
votes
1 answer

How Can I Find Which Component Re-render

I wonder is there any way to see component re-render stuation :)
-1
votes
1 answer

No routes matched location "/wear"

I am developing a simple React application. I get the error "No routes matched location "/wear". What am I doing wrong? App.js: import { Routes, Route } from "react-router-dom"; import Wear from "./pages/Wear"; function Header() { return ( …
-1
votes
1 answer

Pass variable when creating elements in React

I really need your help. I have an array useState with elements 'Screen'. I dynamically add elements to useState to add them to the page. I need to make small changes to each of these elements, the "ID" variable in the Screen. I want to select on…
Romanus
  • 9
  • 6
-1
votes
1 answer

Do we need import react and react-dom nowadays?

Hi,I want to code something about REACT COMPONENT. When I type these two lines in Visual Studio Code: import React from 'React'; import ReactDOM from 'react-dom'.; As screenshot shown,VS suggests me to delete these two lines. Do we no longer need…
-1
votes
1 answer

React does not recognize the `activeStyle` prop on a DOM element

can any one solve this type of error:Warning: React does not recognize the activeStyle prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase activestyle instead. If you accidentally…
-1
votes
2 answers

How to render a component tag or custom tag from props in react

Is it possible to generate a component tag itself from a props? Please help Component is inside above component I wanted to generate a component tag "Avatarcircleuser" by…
PRANAV
  • 1,009
  • 5
  • 16
  • 36
-1
votes
2 answers

React rendering a blank page on importing a component that is passed as a prop and giving the error in console

https://codesandbox.io/s/brave-surf-t3todt?file=/src/components/SidebarOption.js:187-194 The app is functioning perfectly up until I don't use the Icon component in the SidebarOption.js. As soon as I put that in there, a blank page is rendered with…
Aayush
  • 1
  • 1
-1
votes
1 answer

what changes are needed in react lifecycle methods when upgrading react from 16.9.0 to 16.14.0?

I want to upgrade react from 16.9.0 to 16.14.0, I want to know what peer dependencies I should upgrade first, and what needs to be done to react lifecycle methods.
Suman
  • 33
  • 1
  • 1
  • 5
-1
votes
1 answer

Getting a blank page after adding the Routing in react

Am working on a react web application and in my App.js when I pass the components without the routing they get rendered. function App() { return ( <>
abdo berg
  • 27
  • 6
-1
votes
1 answer

./src/index.js Module not found: Can't resolve 'react-dom/client' in "c:\users\....."

Above is the code of the index.js file, below is the error shown in this file I have tried solving this error in many ways, I have also updated the React and React DOM to version "react": "^18.0.0-rc.0", "react-dom": "^18.0.0-rc.0". I also tried…
-1
votes
1 answer

React -- remove dom elements created by an external CDN

I am building a portfolio to show work I have created. It includes some small projects from FreeCodeCamp that are built according to test specs. I would like to include the tests so that someone looking at the code can see the tests. When you embed…
Leddfoot
  • 1
  • 2
-1
votes
1 answer

How can i fix this

I used the latest React-dom version.Each time i run this code on terminal the page goes blank.What could be wrong with this.No console error no compilation error.Just blank `import React from "react"; import { BrowserRouter as…
-1
votes
1 answer

How to write React-jest testing

Following is my index.js file. There I want to test whether the app is render without crashing. import ReactDOM from 'react-dom'; import { StrictMode } from 'react'; import App from './App'; import './index.scss'; ReactDOM.render(
-1
votes
2 answers

How to load new axios data in react component

I've got a navigation menu that correctly loads components with react-router using Entities The components load data using axios and display it in tables. What I'm struggling to accomplish is loading new data when…
Bradmage
  • 1,233
  • 1
  • 15
  • 41