React Native summary of a practice

A, React worldview
1 to change the view by changing the state
view without considering how to change themselves, the state can be drawn.
2, the variable immutable
through the creation of a new state to change the state, making changes traceable, not easy to modify because the rest of the state caused the error unpredictable
3, structure and style separate
reference to the CSS approach, RN's style mechanism makes the code clearer and easier to maintain
4, the use of alternative calling the message
components directly does not call, so that loose coupling between components, easy to maintain and team development
Second, why use React Native?
1, hot update
to start the heat just to be able to update, and performance can accept
2, modular
better reuse and extend
3, cross-platform
business logic can be reused, different components of their platform to achieve
4, unified layout
Third, the design and division
1, assembly tree design
the common components 
React
2, status tree design
common state
Redux
. 3, route design
TabView + Navigator + the Model
REACT-native-Router-Flux
. 4, the division
by components into
Git Flow
four, the RN and the native bidirectional call 
implant Friends of the AU monitoring
native read remote configuration
V. page jump
1, TabView
2, Navigator
3, Modal
4, ExNavigator + Redux
https://github.com/aksonov/react-native-router-flux
six multi-screen adaptation
1, elastic layout can meet the normal development needs
to meet the standard to meet the normal grid layout development needs
2, the elastic layer of the size or the transmission
3, image size
PixelRatio.getPixelSizeForLayoutSize

4, the elastic fault
Dimensions.get ( 'window'). Height

Seven, Redux
1, the separation of business logic and interface
more suitable for cross-platform project

2, State predictable changes
for debugging, reproduce the bug

3, only one state tree
at any time to restore the scene

4, to reduce the number of re-Videos
generating setState be drawn again, the merged state and then redraw redux

Eight hot update
the built-in file when publish RN

Start checking

Updates automatically download updates, and prompts the user to install the update

RN updated replace the local file

https://github.com/Microsoft/react-native-code-push

Nine, debugging and tuning
1, Chrome debugging
2, React-addons-Perf
Perf.start () and Perf.stop ()
Perf.getLastMeasurements ()
3, console.log
more exciting content, please join us to develop hands-on experience exchange QQ group: 163 520 523, there will be unexpected surprises waiting for you!
----------------

Guess you like

Origin www.cnblogs.com/junsehng/p/11404291.html