getting-started
Getting started
Installation
Install @noflux/react
package by using npm:
Example
Here is an Noflux app example. You can also debug it online: https://codesandbox.io/s/z47wLwP8.
Syntax
The connect
in Noflux is a "decorator" in ES Next proposal but also can run in the ES5 environment:
If you use a JavaScript compiler like Babel, you can use @connect
decorator with a sample configuration. Run this command to install decorators plugin:
And modify the .babelrc
file to enable the plugin:
Code examples in the rest documents will be written using decorators syntax.
Interfaces
Noflux only exports two interfaces, state
and connect
。
state
maintains a global unique state and provides methods such asget
andset
to read/write state.
Noflux uses single source of truth and provide an immutable
state
, that is similar to Redux.
connect
will track changes instate
and re-render components intelligently.
A component will be re-rendered via forceUpdate, meaning its
render
method will be called if the value fromstate.get
was changed.
Next steps
I believe you have had a preliminary impression of Noflux. Let's enter the next chapter: basic.
Last updated