spermspace

Untitled

Jul 24th, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // что передаю как пропс
  2.     function groupListCard() {
  3.         cards.map(item => {
  4.         let target = item.colors.length === 0 ?
  5.             item.originalType || item.types[0] : item.colors[0]
  6.  
  7.         switch (target) {
  8.             case "White":
  9.                 return cardsNoPriceWhite.push(item)
  10.             case "Blue":
  11.                 return cardsNoPriceBlue.push(item)
  12.             case "Green":
  13.                 return cardsNoPriceGreen.push(item)
  14.             case "Black":
  15.                 return cardsNoPriceBlack.push(item)
  16.             case "Red":
  17.                 return cardsNoPriceRed.push(item)
  18.             case "Land":
  19.                 return cardsNoPriceLand.push(item)
  20.             case "Artifact":
  21.                 return cardsNoPriceArtifact.push(item)
  22.             default:
  23.                 return
  24.             }
  25.         })
  26.        
  27.         return {
  28.             0: cardsNoPriceWhite,
  29.             1: cardsNoPriceBlue,
  30.             2: cardsNoPriceBlack,
  31.             3: cardsNoPriceGreen,
  32.             4: cardsNoPriceLand,
  33.             5: cardsNoPriceRed,
  34.             6: cardsNoPriceArtifact
  35.         }
  36.     }
  37.  
  38.  
  39. // что передаю в родительском
  40.                 {checkPrint !== ''
  41.                     ?
  42.                     <CheckList groupListCard={groupListCard} />
  43.                     : null
  44.                 }  
  45.  
  46.  
  47. // доча
  48. const CheckList = props => {
  49.     const data = props.groupListCard()
  50.     return (
  51.         <>{
  52.             (() => {
  53.                 for (let i = 0; i < data.length; i++) {
  54.                     switch (i) {
  55.                         case i === 0:
  56.                             console.log('test')
  57.                             break
  58.                         default: return
  59.                     }
  60.                 }
  61.             })
  62.         }</>
  63.     )
  64. }
Add Comment
Please, Sign In to add comment