Skip to content

Instantly share code, notes, and snippets.

View erdemuslu's full-sized avatar
💭
...

Erdem Uslu erdemuslu

💭
...
View GitHub Profile
const Other = () => {
console.log("Merhabalar");
return <div>Merhabalar, ben dahil edilen component'im</div>;
};
class App extends Component {
state = {
firstName: "Erdem",
value: null
};
render() {
return (
<div>
Merhaba React
const Other = memo(() => {
console.log("Merhabalar");
return <div>Merhabalar, ben dahil edilen component'im</div>;
});
@erdemuslu
erdemuslu / useEffect-componentDidMount.js
Last active August 8, 2019 08:34
useEffect-componentDidMount
import React, { useEffect } from 'react'
const App = () => {
useEffect(() => {
console.log('component did mount');
}, []);
return (
<div>
React app
import React, { useState, useEffect } from 'react'
const App = () => {
const [value, setValue] = useState('')
useEffect(() => {
console.log('component did update');
});
return (
import React, { useEffect } from 'react'
const Child = () => {
useEffect(() => {
console.log('componentDidMount')
return () => {
console.log('componentWillUnmount')
}
}, []);
import React, { useState } from 'react'
import Child from './Child'
const App = () => {
const [value, setValue] = useState('')
return (
<div>
React app
<input
// Child Component
// Child Component
// Child Component
import React, { useEffect, useState } from 'react'
import { string } from 'prop-types'
const Child = ({ value }) => {
const [childValue, setChildValue] = useState(value)
useEffect(() => {
import React, { useState } from 'react';
import UserDetails from './components/UserDetails';
const App = () => {
let inputRef;
const [username, setUsername] = useState(null);
return (
<div>
import React from 'react';
import { string } from 'prop-types';
import useGithub from '../hooks/useGithub';
const UserDetails = ({ username }) => {
const { user, error, isLoading } = useGithub(username);
if (isLoading) {
return (