Last active
August 27, 2018 21:49
-
-
Save aspencer8111/e116f16cab8bd0c095cf58fa159bea3d to your computer and use it in GitHub Desktop.
for lexy snowman game
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import words from '../Data/words.json' | |
class WordBox extends Component { | |
constructor() { | |
super() | |
const randomNumber = Math.floor( Math.random() * words.length ) | |
this.state = { | |
randomWord: words[randomNumber] | |
} | |
} | |
render() { | |
return ( | |
<div className="App"> | |
<h1>Your random word is:</h1> | |
<p>{this.state.randomWord}</p> | |
</div> | |
); | |
} | |
} | |
export default WordBox; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment