[20220330 W]

*memo

propstype
storybook
hook (if you need it, make it first)

8 to 17 work
20 clarisse(call)


review

export deffunction usePageHeader(){
const [height, setHeight] = useState(0);
const ref = useRef();
useEffect(()=>setHeight(ref.current.offsetHeight || 0))
return {ref, height};

}

반복되는 거 중복되는 거 훅처리

import use~ from ;

https://kyounghwan01.github.io/blog/React/custome-hook/#%E1%84%89%E1%85%A1%E1%86%BC%E1%84%92%E1%85%AA%E1%86%BC

okay....if I make useFetch hook...

export default function useFetch(){
	const [data, setData ] = useState([]);
    
    useEffect(()=>{
    fetch(url)
    .then(res => res.json())
    .then(data=> setData(data))
    }, [url]
    )
    
    return data

}

const 필요한 값 = useFetch(url 값 넣기)
필요한 값 사용~

operators

literal statement

표현식: 값으로 평가될 수 있는 문

1)arithmetic operator

console.log(5 ** 2); // 25 => math.pow(5,2)

number + string => string

2)unary operators

+,-,!

3)assignmnet operators

c +=10 c -=10 c *=10 c **=10

4)increment/decrement operators

a++ (calculate first)
++a (calculate last)

relational operators

equality operators

value, type

좋은 웹페이지 즐겨찾기