-
-
Save mssoylu/6582d37b1543a0603b11e9e92954890a to your computer and use it in GitHub Desktop.
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 { | |
constructor(props) { | |
super(props); | |
this.state = { deger: 0 } | |
this.arttirFunction = this.arttirFunction.bind(this) | |
} | |
arttirFunction() { | |
this.setState({ deger: this.state.deger + 1 }) | |
} | |
render() { | |
return ( | |
<div> | |
<button onClick={this.arttirFunction}>Tıkla</button> | |
<Content sayi={this.state.deger}></Content> | |
</div> | |
); | |
} | |
} | |
export default App; | |
var Content = React.createClass({ | |
getDefaultProps() { | |
console.log('GET DEFAULT PROPS ÇALIŞTI!') | |
return { ad: 'UMUT' }; | |
}, | |
getInitialState() { | |
console.log('GET INITIAL STATE ÇALIŞTI!') | |
return { ad: 'ARİF' }; | |
}, | |
componentWillMount() { | |
console.log('COMPONENT WILL MOUNT ÇALIŞTI!') | |
}, | |
componentDidMount() { | |
console.log('COMPONENT DID MOUNT! ÇALIŞTI') | |
}, | |
componentWillReceiveProps(newProps) { | |
console.log(newProps.myNumber); | |
console.log('COMPONENT WILL RECIEVE PROPS!') | |
}, | |
shouldComponentUpdate(newProps, newState) { | |
console.log('SHOULD COMPONENT UPDATE ÇALIŞTI!'); | |
return true; | |
}, | |
componentWillUpdate(nextProps, nextState) { | |
console.log('COMPONENT WILL UPDATE ÇALIŞTI!'); | |
}, | |
componentDidUpdate(prevProps, prevState) { | |
console.log('COMPONENT DID UPDATE ÇALIŞTI!') | |
}, | |
componentWillUnmount() { | |
console.log('COMPONENT WILL UNMOUNT ÇALIŞTI!') | |
}, | |
render() { | |
return ( | |
<div> | |
<h3>{this.props.sayi}</h3><br /> | |
<h3>{this.props.ad}</h3><br /> | |
<h3>{this.state.ad}</h3> | |
</div> | |
); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment