Javascript 在redux中连接,不使用任何mapstatetoprops,但仍然可以作为道具获取东西

Javascript 在redux中连接,不使用任何mapstatetoprops,但仍然可以作为道具获取东西,javascript,reactjs,redux,react-redux,Javascript,Reactjs,Redux,React Redux,我在redux的connect中看到了这种奇怪的方式,我很难理解正在做什么以及如何做。 这是连接代码 export default connect(({ cricketFantasy: { matchDetails } }) => { let innings = []; let matchInfo = null; let currentOver = -1; let currentPlayer1Id = null; if (matchDetails &&

我在redux的connect中看到了这种奇怪的方式,我很难理解正在做什么以及如何做。 这是连接代码

export default connect(({ cricketFantasy: { matchDetails } }) => {
  let innings = [];
  let matchInfo = null;
  let currentOver = -1;
  let currentPlayer1Id = null;

  if (matchDetails && Object.keys(matchDetails).length) {
    const {
      homeTeam,
      awayTeam,
      tournament,
      gameDateTime,
      matchDescription,
      venue,
      currentInning,
      officials,
      squad,
      toss,
      matchState
    } = matchDetails;
    if (homeTeam && homeTeam.innings && homeTeam.innings.length) {
      homeTeam.innings.forEach(inning => {
        innings.push({
          order: inning.order,
          battingTeamName: inning.battingTeam,
          isCurrentInning: inning.id === currentInning.id
        });
      });
    }
   // some more operations which i deleted as that is not major concern 
  return {
    innings,
    matchInfo,
    currentOver,
    currentPlayer1Id,
    currentPlayer2Id,
    tournamentId,
    squad: squadObj,
    matchState: matchStateStr,
    isFetchingMatchDetail: false,
    routes,
    detailsData: matchDetails
  };
})(withStyles(styles)(withLocale(CricketScore)));
我试图在组件的render方法内部控制台log,我发现返回的任何东西都可以被视为道具。但是,我担心的是,从{cricketFantasy:{matchDetails}}这一点来了。我在.js文件中的任何地方都看不到cricketFantasy这个术语。 我也没有看到任何MapStateTrops。

{cricketFantasy:{matchDetails}}是一个

它依赖于包含cricketFantasy属性的状态,该属性的值是具有matchDetails属性的对象

基本上,这只是一种奇特的形式:

const matchDetails=state.cricketFantasy.matchDetails

const{matchDetails}=state.com

常量mapStateToProps={matchDetails}}=> console.log{matchDetails}; 常量状态={ 蟋蟀幻想:{ matchDetails:你好 } }; 常量mapStateToProps2=状态=>{ const matchDetails=state.cricketFantasy.matchDetails; console.log{matchDetails}; }; MapStateTopsState;
MapStateTops2State;传递给connect as参数的函数是mapStateToProps。但是术语{cricketFantasy:{matchDetails}来自何处?您能将其分解成几个小部分吗?它来自您的redux存储:const mapStateToProps=state=>//state={cricketFantasy:{matchDetails}