Skip to content

Instantly share code, notes, and snippets.

@kianaditya
Created October 4, 2019 06:43
Show Gist options
  • Save kianaditya/b0fa70b48804e0ac31407f8fc89c1a05 to your computer and use it in GitHub Desktop.
Save kianaditya/b0fa70b48804e0ac31407f8fc89c1a05 to your computer and use it in GitHub Desktop.
refactors file using map
import React from "react";
const GameInformation = () => {
return (
<div className="game-header">
<h1>Rock, Paper, Scissors</h1>
<h3>Welcome, the rules are simple:</h3>
<ul>
{[["ROCK", "SCISSORS"], ["PAPER", "ROCK"], ["SCISSORS", "PAPER"]].map(
array => {
return (
<li>
<span style={{ fontWeight: "700" }}>{array[0]}</span>
<span style={{ padding: "0.4rem" }}>beats</span>
<span style={{ fontWeight: "700" }}>{array[1]}</span>
</li>
);
}
)}
</ul>
</div>
);
};
export default GameInformation;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment