![](/img/trans.png)
[英]How to call function inside another function in React native
[英]how to call a function that is inside another function in react native
我正在嘗試調用另一個 function 內部的 function 並且我需要另一個外部 function 調用它
我需要通過 callSon function 以與我的代碼中相同的方式調用 funcSon function,我只是無法放置必要的代碼來調用它
我的代碼
export function callSon() {
//...space to call the funcSon function
}
export function funcDaddy() {
function funcSon() {
console.log('Hello');
}
return <View></View>;
}
您可以將 state 和funcSon()
邏輯移動到 redux 存儲區。 通過這種方式,它們將成為全球可訪問的。 redux
和redux-thunk
必須是 go https://react-redux.js.org/的方式。 或者您創建一個自定義鈎子來處理該特定部分https://reactjs.org/docs/hooks-custom.html並在需要時重復使用它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.