@@ -8,11 +8,14 @@ Demo: http://cheton.github.io/react-sortable
8
8
The sample code can be found in the [ examples] ( https://github.com/cheton/react-sortable/tree/master/examples ) directory.
9
9
10
10
## Installation
11
+
12
+ ### Webpack or Browserify
11
13
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.
12
14
``` bash
13
15
npm install --save react-sortablejs
14
16
```
15
17
18
+ ### Standalone ES5 module
16
19
You can create a standalone ES5 module as shown below:
17
20
``` bash
18
21
$ git clone https://github.com/cheton/react-sortable.git
@@ -29,6 +32,29 @@ Then, include these scripts into your html file:
29
32
<script src =" dist/react-sortable.min.js" ></script >
30
33
```
31
34
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
+
32
58
## Options
33
59
34
60
#### ` ref ` option
0 commit comments