Skip to content

Commit 2a93ca3

Browse files
committed
fixing final issues
1 parent 3946fa0 commit 2a93ca3

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,9 +1080,9 @@ export { default as Select } from './select';
10801080
// 3. now you can import your components in both ways named (internal) or default (public):
10811081

10821082
// containers/container.tsx
1083-
import { Select } from '../components';
1083+
import { Select } from '@src/components';
10841084
or
1085-
import Select from '../components/select';
1085+
import Select from '@src/components/select';
10861086
...
10871087
```
10881088
@@ -1134,16 +1134,16 @@ Related `ts-lint` rule: https://palantir.github.io/tslint/rules/interface-over-t
11341134
### - how to best initialize class instance or static properties?
11351135
> Prefered modern style is to use class Property Initializers
11361136
```tsx
1137-
class MyComponent extends React.Component<Props, State> {
1137+
class StatefulCounterWithInitialCount extends React.Component<Props, State> {
11381138
// default props using Property Initializers
1139-
static defaultProps: Props = {
1139+
static defaultProps: DefaultProps = {
11401140
className: 'default-class',
11411141
initialCount: 0,
11421142
};
11431143

11441144
// initial state using Property Initializers
11451145
state: State = {
1146-
counter: this.props.initialCount,
1146+
count: this.props.initialCount,
11471147
};
11481148
...
11491149
}
@@ -1152,9 +1152,11 @@ class MyComponent extends React.Component<Props, State> {
11521152
### - how to best declare component handler functions?
11531153
> Prefered modern style is to use Class Fields with arrow functions
11541154
```tsx
1155-
class MyComponent extends React.Component<Props, State> {
1155+
class StatefulCounter extends React.Component<Props, State> {
11561156
// handlers using Class Fields with arrow functions
1157-
increaseCounter = () => { this.setState({ counter: this.state.counter + 1}); };
1157+
handleIncrement = () => {
1158+
this.setState({ count: this.state.count + 1 });
1159+
};
11581160
...
11591161
}
11601162
```

generator/content/4_extras.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ export { default as Select } from './select';
121121
// 3. now you can import your components in both ways named (internal) or default (public):
122122

123123
// containers/container.tsx
124-
import { Select } from '../components';
124+
import { Select } from '@src/components';
125125
or
126-
import Select from '../components/select';
126+
import Select from '@src/components/select';
127127
...
128128
```
129129

generator/content/5_faq.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ Related `ts-lint` rule: https://palantir.github.io/tslint/rules/interface-over-t
1818
### - how to best initialize class instance or static properties?
1919
> Prefered modern style is to use class Property Initializers
2020
```tsx
21-
class MyComponent extends React.Component<Props, State> {
21+
class StatefulCounterWithInitialCount extends React.Component<Props, State> {
2222
// default props using Property Initializers
23-
static defaultProps: Props = {
23+
static defaultProps: DefaultProps = {
2424
className: 'default-class',
2525
initialCount: 0,
2626
};
2727

2828
// initial state using Property Initializers
2929
state: State = {
30-
counter: this.props.initialCount,
30+
count: this.props.initialCount,
3131
};
3232
...
3333
}
@@ -36,9 +36,11 @@ class MyComponent extends React.Component<Props, State> {
3636
### - how to best declare component handler functions?
3737
> Prefered modern style is to use Class Fields with arrow functions
3838
```tsx
39-
class MyComponent extends React.Component<Props, State> {
39+
class StatefulCounter extends React.Component<Props, State> {
4040
// handlers using Class Fields with arrow functions
41-
increaseCounter = () => { this.setState({ counter: this.state.counter + 1}); };
41+
handleIncrement = () => {
42+
this.setState({ count: this.state.count + 1 });
43+
};
4244
...
4345
}
4446
```

0 commit comments

Comments
 (0)