Skip to content

raymondsze/react-example

Repository files navigation

react-example Build Status

Highlight

1. Webpack for bundling

2. Webpack dev server for development. (better use proxy, but to simplify, I clone a html from index.html as dev.html and import script from http://localhost:8081 instead)

3. Simple check boxes list created by React.

4. Covered flux pattern: Alt (folder: src/alt), Redux (folder: src/redux).

5. Covered observer pattern: MObservable (folder: src/mobservable).

6. ES7 scripts style

7. Simple examples to get insight to React, AltJs, Redux, MObservable.

8. Save your time to decide which pattern is best fit for you in using React.

Normal Build

1. git clone

2. cmd: npm install

3. cmd: npm install -g webpack webpack-dev-server

4. cmd: npm run build

5. cmd: npm install -g http-server

6. cmd: http-server

7. go to http://localhost:8080

Hot Module Replacement

1. cmd: http-server

2. cmd: npm run dev

3. go to http://localhost:8080/dev

4. modify the source codes, the browsers will auto-refresh

Performance comparison

go to http://localhost:8080 after Normal Build, try on it, for each library, 2000 checkboxes are rendered for testing.

MObservable is fastest as it observe the observable property used in last render only to reduce unnecessary virtual dom difference.

Code comparison

check the source code of src folder, in my opinon, MObservable and Redux is simplest and Redux is easy to learn.

LICENSE

The MIT License (MIT)

Copyright (c) 2016 Sze Ka Wai Raymond

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

An example of using react to build a checkboxlist

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published