관리 메뉴
목록NATIVE (3)
둘에서 하나로....
react native useEffect 의 변수할당이 안될경우 해결방법
function test(){ const [page, setPage] = useState(0); const [refreshing, setRefresh] = useState(false); const onRefresh = () => { setPage(10); // 이 부분이 적용 안됨. setRefresh(true); // 이 부분이 적용 안됨 } } 위와 같이 했는데... onRefresh가 호출은 되지만 변수가 변경이 되지 않는 문제가 있다. 이럴때는 아래와 같이 변경하므로써 해결 가능하다. const onRefresh = useCallback(async () => { setPage(0); setRefresh(false); }, [refreshing]); 참고용 메모..
프로그래밍
2020. 12. 18. 14:00
react native webVIew를 HOOK으로 호출할떄 ref사용방법
export default function App() { const wvRef = useRef(); return( ); function test(){ let text = "123123"; wvREF.current.injectJavaScript(`(function(){ window.alert('`+text+`'); })(); `); }; } HOOK형태로 사용할때는 current를 넣어주셔야 합니다. >_
프로그래밍
2020. 7. 23. 10:02