1

ライブラリを使用した後normalizr、次の正規化された JSON オブジェクトがアプリケーションの Redux 状態になります。

  { 
    sports: {
        byId: {
          1: {
            id: 1,
            name: 'Soccer',
            slug: 'soccer'
          },
          2: {
            id: 2,
            name: 'Basketball',
            slug: 'basketball'
          },
          3: {
            id: 3,
            name: 'American Football',
            slug: 'american-football'
          }
        },
        allIds: [
          '1',
          '2',
          '3'
        ]
      },
      competitions: {
        byId: {
          '1': {
            id: 1,
            name: 'Competition 1',
            short_name: 'Comp 1',
            slug: 'comp-1',
            sport: 1,
            status: {
             is_live: false 
           }
          },
          '2': {
            id: 2,
            name: 'Competition 2',
            short_name: 'Comp 2',
            slug: 'comp-2',
            sport: 1,
            status: {
             is_live: true 
           }
          },
          '3': {
            id: 3,
            name: 'National Basketball League',
            short_name: 'NBA',
            slug: 'national-basketball-league',
            sport_slug: 'basketball',
            sport: 3,
            status: {
             is_live: true 
           }
          }
        },
        allIds: [
          '1',
          '2',
          '3'
        ]
     }

達成したいこと: でcompetitionsフィルタリング/分類されたリストが必要ですsports

どうやってやるの?

competitionsまた、それでグループ化できるようにしたいですstatus.is_live

では、 true とfalseに等しいcompetitions内訳のリストを取得するにはどうすればよいでしょうか。sportstatus.is_livecompetitions status.is_live

どんな助けでも大歓迎です!ありがとう

4

1 に答える 1