Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-dom

Package Overview
Dependencies
Maintainers
2
Versions
1996
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-dom - npm Package Compare versions

Comparing version 0.1.0 to 0.14.0-beta1

index.js

29

package.json
{
"name": "react-dom",
"version": "0.1.0",
"description": "DOM is a `React.DOM` wrapper with — subjectively — more sanity and awesome helpers",
"author": "Etienne Lemay <etienne@heliom.ca>",
"version": "0.14.0-beta1",
"description": "React package for working with the DOM.",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/EtienneLem/react-dom.git"
"url": "git+https://github.com/facebook/react.git"
},
"homepage": "https://github.com/EtienneLem/react-dom",
"bugs": { "url": "https://github.com/EtienneLem/react-dom/issues" },
"license": "MIT",
"keywords": ["react", "dom"],
"main": "react-dom.js",
"devDependencies": {
"jasmine-node": "2.0.0-beta4",
"react": "0.10.0",
"uglify-js": "2.4.13",
"colors": "0.6.2"
"keywords": [
"react"
],
"license": "BSD-3-Clause",
"bugs": {
"url": "https://github.com/facebook/react/issues"
},
"scripts": {
"test": "./node_modules/.bin/jasmine-node ./spec"
"homepage": "https://github.com/facebook/react/tree/master/npm-react-dom",
"dependencies": {
"react": "^0.14.0-beta1"
}
}

@@ -1,61 +0,54 @@

# DOM
DOM is a `React.DOM` wrapper with — subjectively — more sanity and awesome helpers.
# `react-dom`
## API
#### Optional `options`
```js
DOM.div('foo')
// => React.DOM.div(null, 'foo')
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.
## Installation
```sh
npm install react react-dom
```
#### Allow `class` attribute
## Usage
### In the browser
```js
DOM.div({ class: 'foozle' }, 'foo')
// => React.DOM.div({ className: 'foozle' }, 'foo')
```
var React = require('react');
var ReactDOM = require('react-dom');
### The `data` attribute
#### Nest objects
```js
DOM.div({ data: { state: 'selected' }}, 'foo')
// => React.DOM.div({ 'data-state': 'selected' }, 'foo')
class MyComponent extends React.Component {
render() {
return <div>Hello World</div>;
}
}
ReactDOM.render(<MyComponent />, node);
```
#### Handle arrays
### On the server
```js
DOM.div({ data: { state: ['selected', 'opened'] } }, 'foo')
// => React.DOM.div({ 'data-state-selected': true, 'data-state-opened': true }, 'foo')
```
var React = require('react');
var ReactDOMServer = require('react-dom/server');
## CoffeeScript bliss
I’ll be honest, I don’t really like [JSX](http://facebook.github.io/react/docs/jsx-in-depth.html). It makes you think you’re writing HTML while it is in fact XML. It is getting converted into JavaScript anyway and I prefer not confusing any of my collegues into thinking this is HTML. Since most (read: all) of the projects that I work on are in CoffeeScript, I find the syntax bearable enough.
class MyComponent extends React.Component {
render() {
return <div>Hello World</div>;
}
}
```coffee
Hello = React.createClass
componentWillMount: -> console.log('componentWillMount')
componentDidMount: -> console.log('componentDidMount')
# …
ReactDOMServer.renderToString(<MyComponent />);
```
render: ->
DOM.div class: 'container', [
DOM.span
data:
foo: bar: 'baz'
much: much: 'fun'
class: 'test'
, "Hello #{@props.name}"
## API
DOM.span ', goodbye.'
]
### `react-dom`
console.log React.renderComponentToString Hello(name: 'World')
# <div class="container">
# <span data-foo-bar="baz" data-much-much="fun" class="test">Hello World</span>
# <span>, goodbye.</span>
# </div>
```
- `findDOMNode`
- `render`
- `unmountComponentAtNode`
Now, I know that not everybody works with CoffeeScript, so [here’s the snippet in JavaScript](https://gist.github.com/EtienneLem/3c52167b2ccb6e180132). You can also [see the examples](/examples/index.html), which are in JavaScript.
### `react-dom/server`
## Tests
Run the `npm test` task.
- `renderToString`
- `renderToStaticMarkup`
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc