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

Trouble with binding event handlers in react

What am I doing wrong, specifically when I click the button it gives me: Uncaught TypeError: Cannot read property 'onDismiss' of undefined When is it necessary to bind an event handler to the constructor function? import React, { Component }…
Whymess
  • 697
  • 3
  • 8
  • 20
0
votes
1 answer

ReactDOM.findDOMNode with getAttribute("") returns null

I am defining tooltip as
Vikas Sardana
  • 1,593
  • 2
  • 18
  • 37
0
votes
1 answer

Simple portal component renders a

I have created a simple portal following a tutorial on this site: How to create a React Modal(which is append to ``) with transitions?. The code for the simple portal is: var Portal = React.createClass({ render: () => null, portalElement:…
Chase James
  • 833
  • 1
  • 7
  • 10
0
votes
1 answer

Creating a ReactJS Portal

I am developing a simple modal and some tooltips. I wanted to understand a little about portals so decided to have a go at making one. I have the following code: const Portal = React.createClass({ render() { return null…
Chase James
  • 833
  • 1
  • 7
  • 10
0
votes
1 answer

React not rendering on state change

Here's the code: class Twitch extends React.Component { constructor(props){ super(props); this.state={ channelList:null, streamError:false, channelError:false, } self=this; this.getChannels =…
DroidNoob
  • 1,123
  • 9
  • 21
0
votes
2 answers

Can't Change values of Siblings Reciprocally in ReactJS

I have a component with two fields, it is a converter. It converts between lbs and kg. I am trying to write a component in which whatever input the user changes i.e lbs or kg, the other input fields updates based upon it. The code is working for a…
S. A. Malik
  • 3,465
  • 6
  • 37
  • 56
0
votes
2 answers

Get prevstate in react without es6 script

I write some script that will counting the number when we click the button in reactjs. This is my script: var ComponentCounter = React.createClass({ getInitialState: function() { return {count: 1}; }, doIncrement:function(){ …
cahyowhy
  • 553
  • 2
  • 9
  • 26
0
votes
1 answer

why high order component is not working in react?

could you please tell me why this high order component not working .I am trying to show button and label using HOC .Here is my code http://codepen.io/anon/pen/ygpVeZ var D = (comp) => class extends React.Component{ render (){ return…
user944513
  • 12,247
  • 49
  • 168
  • 318
0
votes
1 answer

I want my menu to update based on which view I'm on React (alternative to reactdom.render)

I'm now convinced I am doing this wrong based on the fact that my app doesn't show the menu unless I open dev tools.. On my landing page, I have a menu bar that has the app name/logo as well as menu items and a log in button in my webapp, like…
adinutzyc21
  • 1,538
  • 1
  • 11
  • 23
0
votes
1 answer

why component is not display in react?

I am trying to use leaflet in react ..I take reference of this module https://github.com/PaulLeCam/react-leaflet https://www.npmjs.com/package/react-leaflet but it not show map why ? here is my…
user944513
  • 12,247
  • 49
  • 168
  • 318
0
votes
2 answers

Dependency injection - Passing child components as props to parent component

I am trying to determine what the idiomatic/canonical way is to pass child components as props of a parent component. I cannot find good examples of this and am struggling to determine if this has anything to do with this.props.children.... Say I…
Alexander Mills
  • 90,741
  • 139
  • 482
  • 817
0
votes
1 answer

ReactDom.render keeps producing undefined prop?

Im pretty sure there is simple answer here. Im still a newbie on React. In the DOM I seem to get values for my console logs, which i'm incrementing just to keep track of how many passes its making (confused by that alone). But at what point is…
Puerto
  • 1,072
  • 3
  • 11
  • 32
0
votes
1 answer

Warning: a div tag was passed a numeric string value for CSS property fontSize which will be treated as a unitless number in a future version of React

I'm getting this warning when trying to style my component: react-dom.js:18121 Warning: a div tag (owner: Letter) was passed a numeric string value for CSS property fontSize (value: 32) which will be treated as a unitless number in a future…
HDJEMAI
  • 9,436
  • 46
  • 67
  • 93
0
votes
3 answers

npm cant find package.json when installing react

This is a followup question to my earlier question (but is an independent question) I am trying to install react and react-dom on a Mac: npm install --save react react-dom but get the following warnings (path names replaced with ...): npm WARN…
Anupam
  • 14,950
  • 19
  • 67
  • 94
0
votes
1 answer

Why isn't a DOM node rendered by React considered a node by React.PropTypes.node validation?

Let's say I have two components: An overlay trigger: import {openOverlay} from './overlay-actions' class OverlayTrigger extends Component { handleMouseOver(event) { // updates global store openOverlay({ triggerNode:…
Matt S
  • 1,892
  • 16
  • 15