Translate

[React] 하위 컴포넌트 함수 실행하기 (Using Redux connect)



환경

 - 언어: TypeScript

 - 기타: Redux connect 를 사용하는 상황



방법

 - GitHub 예제소스: https://github.com/1004lucifer/Test-JavaScript/tree/master/React/typescript-call-child-method-using-redux-connect

 - 데모 페이지: https://1004lucifer.github.io/Test-JavaScript/React/typescript-call-child-method-using-redux-connect/build/index.html


동작 화면



App.tsx (메인 컴포넌트)


AppSubNormal.tsx (일반 하위컴포넌트)


AppSubChanged.tsx (부모 컴포넌트에서 사용 가능하도록 수정)




참고
 - https://ko.reactjs.org/docs/forwarding-refs.html
 - https://ko.reactjs.org/docs/hooks-reference.html
 - https://stackoverflow.com/questions/55180124/forwarding-ref-in-a-functional-component-with-react-redux-v-6-0-1


댓글