Last active
November 27, 2020 20:21
-
-
Save DoctorDerek/b45777ec7978cc08d9c5573a46ee6323 to your computer and use it in GitHub Desktop.
DisplayAllProps.jsx - How to Pass All Props to a Child Component in React
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
const DisplayAllProps = (props) => ( | |
<table> | |
<tbody> | |
{Array.from(Object.entries(props)).map(([key, value]) => ( | |
<tr key={key + Math.random()}> | |
<td>{key}</td> | |
<td>{value}</td> | |
</tr> | |
))} | |
</tbody> | |
</table> | |
) | |
export default DisplayAllProps |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment