09/06/2022
- Refactor userLoader => to make a
reusable
component
user
prop, add resourceUrl
, resourceName
change state user
=> state 상태로
endpoint => resourceUrl
add setState to reflect the change
[] => inside the useEffect array, add resourceUrl
replace user
props to state
(current value of the state)
afterwards
ResourceLoader
=> 비슷해보이지만, a lot more flexible!🎊
instead of user, product 도 넣을 수 있음
!!!
default value 넣거나 && 나 conditional로 코드 짜기!!
ONE STEP FURTHER!
- replace axios call with a function prop
DataSource.js
App.js
props
으로