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
interface IProps { | |
superhero: string; | |
} | |
interface IState { | |
health: number; | |
} | |
export class MyComponent extends React.PureComponent<IProps, IState> { | |
render() { |
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
interface IProps { | |
superhero: string; | |
} | |
interface IState { | |
health: number; | |
} | |
export class MyComponent extends React.PureComponent<IProps, IState> { | |
readonly state = { health: 100 }; |
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
interface IProps { | |
superhero: string; | |
} | |
interface IState { | |
health: number; | |
} | |
const getInitialHealth = (props: IProps) => props.superhero === "Spiderman" ? 0 : 100; |
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
interface IProps { | |
superhero: string; | |
} | |
interface IState { | |
health: number; | |
} | |
export class MyComponent extends React.PureComponent<IProps, IState> { | |
state: IState; |
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> | |
<head> | |
<title>News & Resources</title> | |
</head> | |
<body> | |
<h1>Welcome to News & Resources!</h1> | |
<p>Have fun!</p> |
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 * as React from 'react'; | |
export interface Props { | |
name: string; | |
} | |
export class HelloPerson extends React.PureComponent<Props> { | |
render() { | |
return ( | |
<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 { HelloPerson, Props } from './hello_person.component'; | |
import { shallow } from 'enzyme'; | |
export class HelloPersonDriver { | |
private wrapper; | |
private props: Props = { | |
name: 'some name' | |
} | |
given = { |
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 { HelloPersonDriver } from './hello-person.driver'; | |
describe('Hello Person', () => { | |
let driver: HelloPersonDriver; | |
beforeEach(() => { | |
driver = new HelloPersonDriver(); | |
}); | |
test('should render the name from the prop', () => { |
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 * as React from 'react'; | |
import { reportUserLogin } from '../services/data-service'; | |
interface Props { | |
name: string; | |
} | |
export class HelloPerson extends React.PureComponent<Props> { | |
componentDidMount() { | |
const { name } = this.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 { HelloPerson, Props } from './hello_person.component'; | |
import { shallow } from 'enzyme'; | |
import * as dataService from '../services/data-service'; | |
export class HelloPersonDriver { | |
private wrapper; | |
private props: Props = { | |
name: 'some name' | |
} |