로딩
요청 처리 중입니다...

[JS] 부모-자식 컴포넌트 간 데이터 전송

 [JS] 부모-자식 컴포넌트 간 데이터 전송

우선 아래처럼 한 파일 안에 api, 함수 등 모든 코드가 있는 상황을 보면 정리하고 싶은 마음이 드는 게 당연하다. before, after를 비교하면서 코드가 얼마나 깔끔해졌는지 비교해 본다. //before (onefile.js) export const onefile = ({ navigation: { navigate } }) => { const [originImg_0, setOriginImg_0] = useState(null); const [stillCut_0, setStillCut_0] = useState(null); const [recordDate_0, setRecordDate_0] = useState(""); const GetStillCut_0 = () => { axios.post("http://path/stillcut_0").then((res) => { if (res?.

data) { setStillCut_0(`http://path/static/detected/0/${re...