Skip to content
Open
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
26 changes: 24 additions & 2 deletions src/components/App/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
import React from 'react';
import React , {Component}from 'react';
import Game from '../Game'
import FirstPage from '../FirstPage'
class App extends Component {

export const App = () => <Game />
state = {
gameStarted : false

};

startGame = ( ) => {

this.setState({gameStarted: true})}
render() {
return (
<div>

{ (!this.state.gameStarted )? (<FirstPage startGame={this.startGame} />) : (<Game />)}
</div>

)
}

}

export default App
9 changes: 6 additions & 3 deletions src/components/FirstPage/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import React, {component} from 'react'
const FirstPage = ()=>{
import React from 'react'
const FirstPage = ({startGame})=>{

return(
<div>
<h1>English Learning Game</h1>
<button>start</button>
<button onClick={() => startGame()
}>Start</button>
</div>
)
}

export default FirstPage
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { App } from './components/App';

import App from './components/App';

ReactDOM.render(<App />, document.getElementById('root'));

Expand Down