Skip to content

Instantly share code, notes, and snippets.

@DoctorDerek
Last active November 27, 2020 20:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DoctorDerek/b45777ec7978cc08d9c5573a46ee6323 to your computer and use it in GitHub Desktop.
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
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