@rcp/util.tocompclass
v2.0.0
Published
The utility converting stateless to be component class
Downloads
10
Readme
@rcp/util.tocompclass
The utility converting stateless to be component class
Installation
npm install @rcp/util.tocompclass
# or use yarn
yarn add @rcp/util.tocompclass
Usage
import toComponentClass from '@rcp/util.tocompclass'
const StatelessView = () => <h1>123</h1>
// with lifeCycle
const ConvertedView = toComponentClass(StatelessView)
ConvertedView === StatelessView // false
class View extends React.Component {
render() {
return <h1>123</h1>
}
}
View === toComponentClass(View) // true
API
toComponentClass
Convert stateless component class to be component class
Parameters
component
React.ComponentType
Returns React.ComponentClass<P, S>
Related
- @rcp/util.iscompclass - The utility for checking react component class
Authors
This library is written and maintained by imcuttle, [email protected].
License
MIT