Last active
May 25, 2018 09:43
-
-
Save ValeryC/f6c667d2cbd931ded75094fa9388442e to your computer and use it in GitHub Desktop.
react affichage du nom de l'auteur sur clique. lancer npm start sur terminale
This file contains 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'; | |
class App extends Component { | |
render() { | |
return ( | |
<div className="App"> | |
<Author name='Click for author name'/> | |
<ActionLink /> | |
</div> | |
); | |
} | |
} | |
class Author extends Component { | |
click() { | |
alert('Bob'); | |
} | |
render() { | |
return( | |
<button onClick={this.click.bind(this)}> | |
{this.props.name} | |
</button> | |
) | |
} | |
} | |
//function | |
const ActionLink = () => { | |
return ( | |
<a href="https://google.co.uk"> | |
Click me | |
</a> | |
); | |
} | |
export default App; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment