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
| class Greeting extends React.Component { | |
| constructor() { | |
| super(); | |
| this.state = { | |
| name: "", | |
| }; | |
| } | |
| componentDidMount() { | |
| // AJAX |
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 GreetingCard = (props) => { | |
| return ( | |
| <div> | |
| <h1>Hello! {props.name}</h1> | |
| </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
| const GreetingCard = (props) => { | |
| return ( | |
| <div> | |
| <h1>{props.name}</h1> | |
| </div> | |
| ) | |
| } | |
| class Greeting extends React.Component { | |
| constructor() { |
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 {withRouter} from 'react-router-dom'; | |
| class App extends React.Component { | |
| constructor() { | |
| super(); | |
| this.state = {path: ''} | |
| } | |
| componentDidMount() { | |
| let pathName = this.props.location.pathname; |
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
| class Counter extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { | |
| count: 0, | |
| }; | |
| } | |
| increment = () => { | |
| this.setState(prevState => { |
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 styled from 'styled-components'; | |
| const Title = styled.h1` | |
| font-family: 'Raleway', sans-serif; | |
| font-weight: 600; | |
| color: #4d4d4d; | |
| font-size: 2.2em; | |
| `; |
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 styled from 'styled-components'; | |
| const Title = styled.h1` | |
| font-family: 'Raleway', sans-serif; | |
| font-weight: 600; | |
| color: #4d4d4d; | |
| font-size: 2.2em; | |
| `; |
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 styled from 'styled-components'; | |
| // Forms, inputs, buttons | |
| export const Form = styled.form` | |
| width: 300px; | |
| display: flex; | |
| flex-direction: column; | |
| align-items: center; | |
| `; |
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 styled from 'styled-components'; | |
| import {Form, Input, Title, Button} from './theme.js'; | |
| class App extends Component { | |
| render() { | |
| return ( | |
| <div> | |
| <Title>Form</Title> | |
| <Form> |
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 styled from 'styled-components'; | |
| export const Input = styled.input` | |
| width: 300px; | |
| height: 35px; | |
| border: ${props => props.border || '1px solid #ccc'}; | |
| background-color: #fff; | |
| `; |
OlderNewer