@rcp/util.iscompclass
v2.0.0
Published
The utility for checking component class
Downloads
1,411
Maintainers
Readme
@rcp/util.iscompclass
The utility for checking react component class
Installation
npm install @rcp/util.iscompclass
# or use yarn
yarn add @rcp/util.iscompclass
Usage
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
API
isComponentInstance
Determine react component instance
Parameters
instance
{any}
Examples
import { isComponentInstance } from '@rcp/util.iscompclass'
class View extends React.Component {}
isComponentInstance(View.prototype)
Returns boolean
isComponentClass
Determine react component class
Parameters
component
{any}
Returns boolean
Related
- @rcp/util.iselemof - The utility for determinate the input is element of the component class
Authors
This library is written and maintained by imcuttle, [email protected].
License
MIT