J
J
jeka-32019-05-06 14:12:55
React
jeka-3, 2019-05-06 14:12:55

How to set different block colors using props?

How to set different block colors using props ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2019-05-06
@jeka-3

<div>
  <Block color="red" />
  <Block color="green" />
  <Block color="blue" />
</div>

const colors = ['red', 'green', 'blue'];

return (
  <div>
    {colors.map((color, i) => <Block key={i} color={color} />}
  </div>
);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question