Step1/04 - React Intro - final demo - fix to show the customized buttons (#131)

* Fix Step1/04 - React Intro - final

Problem:
1. Customized Button.tsx is not used in Counter.tsx
2. index.tsx still renders the 'hello world' text

Fix:
1. Use customized Button.tsx in Counter.tsx
2. Have index.tsx render the App component instead of 'hello world' text

Notes:
Validated customized button now show correctly.

* Add missing blank line.
This commit is contained in:
JakubK44
2019-08-19 13:13:42 -07:00
committed by Micah Godbolt
parent 6de6cb0f1e
commit cb21996186
2 changed files with 4 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
import React from 'react'; import React from 'react';
import { Button } from './Button';
export class Counter extends React.Component<any, any> { export class Counter extends React.Component<any, any> {
constructor(props) { constructor(props) {
@@ -13,7 +14,7 @@ export class Counter extends React.Component<any, any> {
return ( return (
<div> <div>
{text}: {clicks} {text}: {clicks}
<button onClick={this._onButtonClick}>Click</button> <Button onClick={this._onButtonClick}>Click</Button>
</div> </div>
); );
} }

View File

@@ -1,4 +1,5 @@
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import { App } from './App';
ReactDOM.render(<p>hello world </p>, document.getElementById('app')); ReactDOM.render(<App />, document.getElementById('app'));