Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pages/tutorials/React & Webpack.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ First, create a file named `Hello.tsx` in `src/components` and write the followi
```ts
import * as React from "react";

export interface HelloProps { compiler: string; framework: string; }
export interface HelloProps { readonly compiler: string; readonly framework: string; }

export const Hello = (props: HelloProps) => <h1>Hello from {props.compiler} and {props.framework}!</h1>;
```
Expand All @@ -125,7 +125,7 @@ Note that while this example uses [function components](https://reactjs.org/docs
```ts
import * as React from "react";

export interface HelloProps { compiler: string; framework: string; }
export interface HelloProps { readonly compiler: string; readonly framework: string; }

// 'HelloProps' describes the shape of props.
// State is never set so we use the '{}' type.
Expand Down
20 changes: 10 additions & 10 deletions pages/tutorials/React.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ We'll write a `Hello.tsx`:
import * as React from 'react';

export interface Props {
name: string;
enthusiasmLevel?: number;
readonly name: string;
readonly enthusiasmLevel?: number;
}

function Hello({ name, enthusiasmLevel = 1 }: Props) {
Expand Down Expand Up @@ -362,8 +362,8 @@ For this, we can create a file called `src/types/index.tsx` which will contain d
// src/types/index.tsx

export interface StoreState {
languageName: string;
enthusiasmLevel: number;
readonly languageName: string;
readonly enthusiasmLevel: number;
}
```

Expand Down Expand Up @@ -393,11 +393,11 @@ Next, we'll create a set of actions and functions that can create these actions
import * as constants from '../constants'

export interface IncrementEnthusiasm {
type: constants.INCREMENT_ENTHUSIASM;
readonly type: constants.INCREMENT_ENTHUSIASM;
}

export interface DecrementEnthusiasm {
type: constants.DECREMENT_ENTHUSIASM;
readonly type: constants.DECREMENT_ENTHUSIASM;
}

export type EnthusiasmAction = IncrementEnthusiasm | DecrementEnthusiasm;
Expand Down Expand Up @@ -468,10 +468,10 @@ We'll add two optional callback properties to `Props` named `onIncrement` and `o

```ts
export interface Props {
name: string;
enthusiasmLevel?: number;
onIncrement?: () => void;
onDecrement?: () => void;
readonly name: string;
readonly enthusiasmLevel?: number;
readonly onIncrement?: () => void;
readonly onDecrement?: () => void;
}
```

Expand Down