The utility for checking react component class
npm install @rcp/util.iscompclass
# or use yarn
yarn add @rcp/util.iscompclass
import isComponentClass from '@rcp/util.iscompclass'
import * as createClass from 'create-react-class'
import * as React from 'react'
// es6
class View extends React.Component {}
isComponentClass(View) // true
// es5
const Comp = createClass({
render() {
return <div>hi</div>
}
})
isComponentClass(Comp) // true
isComponentClass(<Comp />) // false
Determine react component instance
instance
{any}
import { isComponentInstance } from '@rcp/util.iscompclass'
class View extends React.Component {}
isComponentInstance(View.prototype)
Returns boolean
Determine react component class
component
{any}
Returns boolean
- @rcp/util.iselemof - The utility for determinate the input is element of the component class
This library is written and maintained by imcuttle, moyuyc95@gmail.com.
MIT