第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

反應(yīng)導(dǎo)航:檢測應(yīng)用導(dǎo)航到哪個(gè)屏幕

反應(yīng)導(dǎo)航:檢測應(yīng)用導(dǎo)航到哪個(gè)屏幕

qq_笑_17 2021-04-04 15:11:24
我有2個(gè)組成部分:儀表板-應(yīng)用程序的入口點(diǎn)帖子在儀表板中,componentDidMount中有一個(gè)API調(diào)用。在“帖子”組件中,收到帖子后,我導(dǎo)航至“儀表板”。是否可以檢測應(yīng)用是否已從“帖子”導(dǎo)航到“儀表板”并刪除componentDidMount中的API調(diào)用。檢查以下代碼:// Dashboard.js componentDidMount() {   this.handleApiCall(); // default axios get request// Here I need to detect if the user was navigated to Dashboard from Posts or other component}// Posts.js  handleNavigation = () => {    this.setState({      isOpen: false,    });      this.props.navigation.navigate('Dashboard'); };
查看完整描述

1 回答

?
慕森卡

TA貢獻(xiàn)1806條經(jīng)驗(yàn) 獲得超8個(gè)贊

嘗試傳遞來自的參數(shù) Posts.js


// Dashboard.js

componentDidMount() {


   const { navigation } = this.props;

   const fromPosts = navigation.getParam('fromPosts', false);

   if(!fromPosts) {

     this.handleApiCall(); // default axios get request

   }


}



// Posts.js

handleNavigation = () => {

    this.setState({

      isOpen: false,

    });


    this.props.navigation.navigate('Dashboard', {fromPosts: true});

 };


查看完整回答
反對 回復(fù) 2021-04-08
  • 1 回答
  • 0 關(guān)注
  • 186 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)