Created
February 17, 2020 09:54
-
-
Save Andy-set-studio/25eb4e0178d2ce71a9ffefc3c7e87e02 to your computer and use it in GitHub Desktop.
Heading React Component
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' | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: