Skip to content

Commit 20a7a61

Browse files
committed
Update README.md
1 parent 8c12ffe commit 20a7a61

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@ Demo: http://cheton.github.io/react-sortable
88
The sample code can be found in the [examples](https://github.com/cheton/react-sortable/tree/master/examples) directory.
99

1010
## Installation
11+
12+
### Webpack or Browserify
1113
The easiest way to use react-sortablejs is to install it from npm and include it in your React build process using webpack or browserify.
1214
```bash
1315
npm install --save react-sortablejs
1416
```
1517

18+
### Standalone ES5 module
1619
You can create a standalone ES5 module as shown below:
1720
```bash
1821
$ git clone https://github.com/cheton/react-sortable.git
@@ -29,6 +32,29 @@ Then, include these scripts into your html file:
2932
<script src="dist/react-sortable.min.js"></script>
3033
```
3134

35+
Example:
36+
```js
37+
var MySortable = React.createClass({
38+
displayName: 'MySortable',
39+
getInitialState: function() {
40+
return { items: ['Apple', 'Banana', 'Cherry'] };
41+
},
42+
render: function() {
43+
return (
44+
React.createElement('ul', { ref: "list" },
45+
this.state.items.map(function(item, key) {
46+
return React.createElement('li', { key: key }, item);
47+
})
48+
)
49+
);
50+
}
51+
});
52+
ReactDOM.render(
53+
React.createElement(SortableMixin.default()(MySortable), null),
54+
document.getElementById('container')
55+
);
56+
```
57+
3258
## Options
3359

3460
#### `ref` option

0 commit comments

Comments
 (0)