The previous article shows the basic use of redux, you can see Redux is very easy to use, not limited to react, can also be used in angular, Vue and other frameworks, as long as the need to redux the design of the idea of the place, you can use it.This article mainly explains the use of redux in react, the first is the installation.Installing React Reduxyarn add
├──index.ios.js
├──ios/
├──package.json └──web/
└──webpack.config.js
Step Two: Add the Portal file and configure iteach project needs to have a portal file that is typically used to introduce calls to other components and initialize the project, such as Index.ios.js, which represents the entry file for the project on the iOS platform. To conform to the React Native file naming specification, we crea
React-native Getting Started GuideGitHub:https://github.com/vczero/react-native-lession React-native: Develop your native app with JavaScript, unleash the Native UI experience and experience hybird development efficiency.The last one weeks of writing the article below, the link is GitHub page, in fact, you can also find the article in the series blog:
Le
a closer look and you'll find:
Router and route are the same react component, its history object is the core of the whole routing system, it burst a lot of properties and methods used in the routing system;
The path property of the route indicates the route component, which can be an absolute or relative path, and the relative path can be inherited;
Redirect is a redirect component that has a from and to two attributes;
The OnEnt
For many react novices, the resources available online are mostly simple tutorial that teach you how to use react, but don't tell you how to gracefully organize and write react code in real-world projects. Google search Chinese "React best practices" found that the first two pages are almost all the same translation of
Compared with angular React, atitit. react is the most reliable web ui componentization solution. reactangular
Compared with angular React, atitit. react is the most reliable web ui componentization solution.
1. componentization of React is the correct direction of web ui
To solve the problem that react-router/react-router-dom v4 history cannot be accessed,
Preface
Recently I upgraded react-router. When using react-router-dom, the sub-component uses this. props. history cannot be found. Check the official documentation and I haven't found it for a long time, because I jumped to the page
https://reactjs.org/docs/jsx-in-depth.htmlJSX in DepthHttps://babeljs.io/JS Compiler, learn the direct conversion of react and JS. JSX only supports syntactic sugar syntactic sugar:react.createelement (component, props, ... children) function,JSX Code: MyButton Color ="Blue" shadowsize ={2} >Click Me MyButton> Compiling compiles into:React.createelement (MyButton,{color: ' Blue ', shadowsize:2},' Click Me ')You can also use the self_closing form of
easier to learn such ViewPagerAndroid components. We can use this component for advertising, carousel, and other related effects ~
First, let's take a look at the official instance (I have modified it accordingly). The specific code is as follows:
'Use strict '; import React, {AppRegistry, Component, StyleSheet, Text, View, ViewPagerAndroid,} from 'react-native
1, the problem background
Using React's attribute proptypes, you can accept arbitrary strings, objects, functions, and so on.
2, the realization of the source code
The properties of the React component proptypes
3,
Functional Requirements
1> display 1 images during initialization, 1 seconds later, hide image
2> Click the button to show 1 pictures, 1 seconds later, hide the picture
principle
Bind this itself, using anonymous functions
Using settimeout
, css, html) = show (page display)
Implementation logic of react-router:
Jump = "path =" component = "static resources (js, css, html) =" show (page display)This article focuses on react-router. The following describes how to use react-router:
React-getting started with common router
Android React Native has encapsulated several common native components, such as ScrollView and TextInput, but not all of the original components of the system are encapsulated, so sometimes we have to do it ourselves. In order to be able to use
-scripts": "1.1.1"
}
There is no other dependency, so if you want to add some libraries (UI components or something) yourself, install Antd
First install the Scaffold
NPM Install Antd-init-g
Then CD to the directory you want to build the project to
Antd-init
Then run the project
NPM start
ANTD Scaffolding relies on one of his own packages Antd
"Dependencies": {"
antd": "^3.0.0",
"moment": "^2.19.3",
"
://github.com/remobile/react-native-toast
Get all kinds of information about equipmentHttps://github.com/rebeccahughes/react-native-device-info
Webstorm Reactnative's Code template plugin, including:1. Component Name 2. Api name 3. All stylesheets Properties 4. Component PropertiesHttps://github.com/virtoolswebplayer/ReactNative-LiveTemplate
React-native calling
interaction)Config is some basic configuration. Interface Name, etc.Constants are some constants.Containers Smart components handle the data and business layers. Passing properties to the view layer, etc.Fetch is the sending requestReducer redux of each sub-Reducer merged togetherRouter Creating a routeStore stores the corresponding status in the ReduxUil (Can not.) Handling of public data)9:index.js start the first screen app.js10:componets the corr
React component writing Summary
React focuses on the view layer. componentization is the basis of React and one of its core concepts. A complete application will be assembled by independent components.
Up to now, React has been updated to v15.4.2. Due to the popularity of ES
Preface:
because mixin is contrary to JavaScript semantics, React ES6 uses higher-order components instead of mixins. In This section, we will focus on how to replace the traditional React mixins with higher-order components. How do we use ES6 to handle mixin?
What is a high-order component?
Adding logic to an existi
Module referenceIn ES5, if the CommonJS standard is used, The React package is introduced through require. The code is similar to this:// ES5Var React = require ("react-native ");Var {Image,Text,View,} = React; // reference different React Native componentsIn ES6,
(Use require to import the dependencies first, then create the components with reactTo create a dependent APP1,APP2,APP3 3 JSvar React=require (' React '); var head=React.createclass ({ render:function() { return ( Head } ) module.exports=head;Simple example creation is done, required
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.