Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Heading React Component
import React from 'react'
import PropTypes from 'prop-types'
const Heading = ({children, cssClass, level}) => {
const Tag = `h${level}`
return <Tag className={cssClass}>{children}</Tag>
Heading.propTypes = {
children: PropTypes.node.isRequired,
level: PropTypes.number.isRequired,
cssClass: PropTypes.string
export default Heading
Copy link

hankchizljaw commented Feb 17, 2020


import Heading from './heading.js';

<Heading level={2}>Hello, I am a second level heading</Heading>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment