전체 글
-
javaScript Destructuring assignment에 관하여js 2022. 8. 20. 17:31
const myObj = { a: 1, b: 2 }; const { a, b } = myObj; // is equivalent to: // const a = myObj.a; // const b = myObj.b; const obj = { a: 1, b: 2 }; const { c, b } = obj; const obj = { a: 1, b: { c: 2 } }; const { a, b: { c: d } } = obj; // Two variables are bound: `a` and `d` const obj = { a: "spam" } const { a: x } = obj
-
React, useEffect and useCallback flow, 리액트 useEffect와 useCallback 의 사용법과 플로우에 대하여js 2022. 8. 20. 03:20
우선 플로우를 설명하기에 앞서 rendering된 예제 페이지와 코드는 아래와 같습니다. import { useState, useEffect, useCallback } from 'react' import './TripList.css' const TripList = () => { const [trips, setTrips] = useState([]) const [url, setUrl] = useState('http://localhost:3000/trips') const fetchTrips = useCallback(async () => { console.log("fetchTrips useCallback function") const response = await fetch(url) const json = aw..
-
React useEffect and useState simple flow, 리액트 useEffect와 useState의 플로우를 간단하게 알아보기js 2022. 8. 19. 19:36
우선 플로우를 설명하기에 앞서 rendering된 예제 페이지는 이렇게 생겼습니다. import { useState, useEffect } from 'react' const TripList = () => { const [trips, setTrips] = useState([]) const [url, setUrl] = useState('http://localhost:3000/trips') useEffect(()=>{ console.log("useEffect function") fetch(url) .then(response => response.json()) .then(json => setTrips(json)) }, [url]) console.log(trips) return( Trip List {trips.m..
-
Python json dump and loadPython/pytest 2022. 1. 1. 13:40
How to use json dump and json load from fixtures using tmpdir_factory? We need two separate files First conftest.py file, and the second test_auhor.py file #conftest.py @pytest.fixture(scope="module") def author_file_json(tmpdir_factory): """Write some authors to a data file.""" python_author_data = { 'Ned': {'City':'Boston'}, 'Brian': {'City': 'Portland'}, 'Luciano': {'City': 'Sau Paulo'} } fil..