Migration from noflux to v0.x
Last updated
Last updated
Noflux's predecessor was the noflux
project (NPM:noflux,Github:ssnau/noflux). Noflux's concepts were mainly learned from the latter, and Noflux's development was supported by the noflux
developer ssnau.
Noflux is made up of several NPM packages with a certain dependency. To prevent confusion with the noflux
project, these packages are prefixed by @noflux.
It is highly recommended that noflux
users should migrate to Noflux because it offers a lot of new features:
state.cursor
is isomorphic to state
.
@connect
use partial connecting to avoid a lot of repetitive re-rendering and improve rendering performance.
Completely refactored listener tree has been fully tested and optimized performance.
state.cursor
Unlike noflux
, state.cursor
returns a State
instance from @noflux/state. So you can do this for the state.cursor
instance, .set
, .get
, .cursor
, and so on.
Migrate as follows:
cursor.mergeUpdate
Do not support any operations that require deep cloning, use cursor.set
instead.
state.toJS
Use state.get()
instead
state.on
and cursor.on
Noflux has adjusted event names, but is still compatible whthin noflux
.
More details in this pull-request.
Note:The
update
event in the official version (1.x) is retained yet to be determined. It is recommended to use theset
event instead. If you still needupdate
event please issue here.
Note: All deprecated API may be removed from subsequent releases. Please migrate as soon as possible
state.load
Use state.set(data)
instead. The deprecated one can still be used but will output the following information:
@pure
React version 15.3.0 introduced PureComponent,So it is recommended to use PureComponent
directly in 15.3.0
and later versions. The @pure
decorator can still be used but will output the following information:
@Connect
Use @connect
instead,The deprecated one can still be used but will output the following information:
Operating
noflux
Noflux
Get cursor
const cursor = state.cursor('a.b')
const cursor = state.cursor('a.b')
Get state
cursor()
cursor.get()
Change state
cursor.update(value)
cursor.set('value')
Change state
cursor.update(fn)
No longer supported, please use .get
and .set
Get ext cursor
-
cursor.cursor('c.d')