is-string-functional-component
v1.0.3
Published
Checks whether a string is a React functional component.
Downloads
7
Maintainers
Readme
Usage
import isStringFunctionalComponent from "is-string-functional-component"
const functionalComponent =
`function ExampleComponent() {
return <h1>This is an example!</h1>
}`
isStringFunctionalComponent(functionalComponent) // Returns true.
const randomString = "foo";
isStringFunctionalComponent(randomString) // Returns false.
const classComponent =
`class Test extends React.component {
render(<h1>Testing</h1>);
}`
isStringFunctionalComponent(classComponent) // Returns false.