This file contains hidden or 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, { Suspense, lazy } from 'react'; | |
| import { HashRouter as Router, Route, Link } from 'react-router-dom'; | |
| const Home = lazy(() => import('./Home')); | |
| const Page1 = lazy(() => import('./Page1')); | |
| function WaitingComponent(Component) { | |
| return props => ( | |
| <Suspense fallback={<div>Loading...</div>}> | |
| <Component {...props} /> |
This file contains hidden or 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, { Suspense, lazy } from 'react'; | |
| import { HashRouter as Router, Route, Link } from 'react-router-dom'; | |
| import Home from './Home'; | |
| import Page1 from './Page1'; | |
| export default () => ( | |
| <Router> | |
| <div> | |
| <Route exact path="/"> | |
| <Link style={{marginRight: '30px'}} to="/">Home</Link> |
This file contains hidden or 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
| const obj = { | |
| class: { | |
| stu1: { | |
| name: 'Andy' | |
| }, | |
| stu2: { | |
| name: 'John' | |
| } | |
| } | |
| }; |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>Document</title> | |
| </head> | |
| <body> | |
| <div id="app"></div> |
This file contains hidden or 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, { Component } from 'react'; | |
| import { | |
| Platform, | |
| StyleSheet, | |
| Text, | |
| View, | |
| Dimensions, | |
| } from 'react-native'; | |
| import styled from 'styled-components/native'; |
This file contains hidden or 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
| const StatusBarBackground = styled.View` | |
| height: 20; | |
| backgroundColor: #fff; | |
| `; |
This file contains hidden or 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
| const MainView = styled.View` | |
| backgroundColor: ${Platform.OS === 'ios' ? 'black' : 'red'}; | |
| `; |
This file contains hidden or 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
| // without {...this.props} | |
| const HOC = (WrappedComponent) => { | |
| return class extends Component { | |
| render() { | |
| return ( | |
| <WrappedComponent /> | |
| ) | |
| } | |
| } | |
| } |
This file contains hidden or 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, { Component } from 'react'; | |
| import PropTypes from 'prop-types'; | |
| const withMouse = (WrappedComponent) => { | |
| return class extends Component { | |
| state = { | |
| x: 0, | |
| y: 0, | |
| } |