Skip to content

Commit 546a0e5

Browse files
committed
Add forgotten resource ../99_readme_resources/04 Callback/browser_output.png and fix import modules. This closes #12
1 parent a49dec1 commit 546a0e5

File tree

6 files changed

+10
-20
lines changed

6 files changed

+10
-20
lines changed

04 Callback/readme.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ from a stateless component into a class component, then we will add some refacto
3838
```jsx
3939
import * as React from 'react';
4040

41-
class NameEditComponent extends React.Component {
41+
export class NameEditComponent extends React.Component {
4242

4343
constructor(props) {
4444
super(props);
@@ -75,15 +75,12 @@ from a stateless component into a class component, then we will add some refacto
7575
initialUserName: React.PropTypes.string.isRequired,
7676
onNameUpdated: React.PropTypes.func,
7777
};
78-
79-
export default NameEditComponent;
80-
8178
```
8279

8380
- Let's wire this up in the `app.jsx` file.
8481

8582
```jsx
86-
class App extends React.Component {
83+
export class App extends React.Component {
8784
constructor(props) {
8885
super(props);
8986
this.state = { userName: 'defaultUserName' };
@@ -107,7 +104,6 @@ from a stateless component into a class component, then we will add some refacto
107104
}
108105
}
109106

110-
export default App;
111107
```
112108

113109
Now we've got a clear event, strongly typed and simplified (straight forward).

04 Callback/src/app.jsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from 'react';
2-
import HelloComponent from './hello';
3-
import NameEditComponent from './nameEdit';
2+
import { HelloComponent } from './hello';
3+
import { NameEditComponent } from './nameEdit';
44

5-
class App extends React.Component {
5+
export class App extends React.Component {
66
constructor(props) {
77
super(props);
88
this.state = { userName: 'defaultUserName' };
@@ -25,5 +25,3 @@ class App extends React.Component {
2525
);
2626
}
2727
}
28-
29-
export default App;

04 Callback/src/hello.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import * as React from 'react';
22

3-
const HelloComponent = props => (
3+
export const HelloComponent = props => (
44
<h2>Hello user: {props.userName}!</h2>
55
);
66

77
HelloComponent.propTypes = {
88
userName: React.PropTypes.string.isRequired,
99
};
10-
11-
export default HelloComponent;

04 Callback/src/main.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import React from 'react';
44
import { render } from 'react-dom';
5-
import App from './app';
5+
import { App } from './app';
66

77
render(
8-
<App />,
9-
document.getElementById('root')
8+
<App />
9+
, document.getElementById('root')
1010
);

04 Callback/src/nameEdit.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22

3-
class NameEditComponent extends React.Component {
3+
export class NameEditComponent extends React.Component {
44

55
constructor(props) {
66
super(props);
@@ -37,5 +37,3 @@ NameEditComponent.propTypes = {
3737
initialUserName: React.PropTypes.string.isRequired,
3838
onNameUpdated: React.PropTypes.func,
3939
};
40-
41-
export default NameEditComponent;
28.6 KB
Loading

0 commit comments

Comments
 (0)