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
| this.setState ( { | |
| clicked: true, | |
| }, () => { | |
| console.log('the state is now', this.state) |
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 Row from './Row' | |
| class App extends Component { | |
| constructor(props){ | |
| super(props) | |
| this.state = { | |
| name: 'Ebru', | |
| } | |
| // this.handleNameChange = this.handleNameChange.bind(this) |
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 from 'react' | |
| const Row = props => { | |
| return( | |
| <div> | |
| {props.children} | |
| </div> | |
| ) | |
| } |
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 from 'react'; | |
| class Counter extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { | |
| count: 0, | |
| }; | |
| } |
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, { useState } from 'react'; | |
| function Counter() { | |
| const [count, setCount] = useState(0); | |
| return ( | |
| <div> | |
| <p>{count}</p> | |
| <button onClick={() => setCount(count + 1)}> | |
| Click me |
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
| class MyComponent extends Component { | |
| componentDidMount() { | |
| // verileri çekmek için api listener ekledik | |
| // mouse hareketleri için event listener ekledik. | |
| } | |
| componentWillUnmount() { | |
| // api listener'ı kaldır | |
| // event listener'ı kaldır | |
| } |
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
| //Kim, neden, neyi, ne için extends ediyor? | |
| class Counter extends Component { | |
| // State'i direk tanımlayabilir miyiz? | |
| state = { value: 0 }; | |
| // Neden props kullanıyoruz? | |
| // constructor(props) { | |
| // | |
| // super ne alaka? | |
| // super(props); |
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
| const [value, setValue] = useState('initial'); | |
| useEffect(() => { | |
| console.log(value); | |
| }, [value]) |
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
| useEffect(() => { | |
| console.log('mounted'); | |
| return () => console.log('unmounting...'); | |
| }, []) |
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, { useEffect, useState, useRef } from "react"; | |
| import ReactDOM from "react-dom"; | |
| function App() { | |
| const inputRef = useRef(); | |
| const [value, setValue] = useState(""); | |
| useEffect( | |
| () => { | |
| console.log("render"); |