Instantly share code, notes, and snippets.

@soner8 /app.js
Created Apr 17, 2018

Embed
What would you like to do?
Author
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import logo from './logo.svg';
import './App.css';
import Author from './test';
class App extends Component {
render() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h1 className="App-title">Welcome to React</h1>
</header>
<p className="App-intro">
To get started, edit <code>src/App.js</code> and save to reload.
</p>
</div>
);
}
}
ReactDOM.render(<Author name='bob' />, document.getElementById('root'));
export default App;
import React, {Component} from 'react';
import logo from './logo.svg';
import './App.css';
class Author extends Component {
fonctionAuClic() {
console.log('clic');
alert(this.props.name);
}
render() {
return(
<div onClick={this.fonctionAuClic.bind(this)}>
{this.props.maprop}
<p>Salut</p>
</div>
);
}
}
export default Author;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment