{
"compilerOptions": {
"baseUrl": "./src",
"target": "ES6",
"jsx": "preserve",
"allowSyntheticDefaultImports": true
},
"exclude": ["build", "node_modules"]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// HOC版本 | |
const withDelayHint = (loadingPropName, delay) => ComponentIn => class extends Component { | |
state = { | |
timer: null, | |
isDelayed: false | |
}; | |
tryStartTimer = () => { | |
clearTimeout(this.state.timer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example using create-react-app. | |
// For scratch configurations, add babel-plugin-transform-class-properties. | |
// More info: https://babeljs.io/docs/plugins/transform-class-properties/ | |
import React from 'react' | |
class Example extends React.Component { | |
example = (param) => () => { | |
console.log('Hello ', param) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { reduxForm, Field } from 'redux-form'; | |
import { ScrollView, Text, TouchableOpacity } from 'react-native'; | |
import moment from 'moment'; | |
import MyTextInput from './MyTextInput'; | |
/** | |
* Automatically adds the dashes required by the specified phone format and limits the input to ten characters | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react'; | |
import { Component } from 'react'; | |
export default function HOCBaseRender<Props, State, ComponentState>( | |
Comp: new() => Component<Props & State, ComponentState>) { | |
return class HOCBase extends Component<Props, State> { | |
render() { | |
return <Comp {...this.props} {...this.state}/>; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Col = require('react-bootstrap/lib/Col') | |
var PageHeader = require('react-bootstrap/lib/PageHeader') | |
var React = require('react') | |
var Row = require('react-bootstrap/lib/Row') | |
var {connect} = require('react-redux') | |
var {reduxForm} = require('redux-form') | |
var DateInput = require('./DateInput') | |
var FormField = require('./FormField') | |
var LoadingButton = require('./LoadingButton') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var data = [ | |
{ | |
"text": "Link 1", | |
"url": "#" | |
}, | |
{ | |
"text": "Link 2", | |
"url": "#" | |
}, | |
{ |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.