@rcp/util.tocompclass
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

@rcp/util.tocompclass

NPM version NPM Downloads

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

Authors

This library is written and maintained by imcuttle, moyuyc95@gmail.com.

License

MIT

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.0.00latest

Version History

VersionDownloads (Last 7 Days)Published
2.0.00
1.0.151
1.0.131
1.0.111
1.0.91
1.0.80
1.0.70
1.0.60
1.0.50

Package Sidebar

Install

npm i @rcp/util.tocompclass

Weekly Downloads

4

Version

2.0.0

License

MIT

Unpacked Size

12.6 kB

Total Files

11

Last publish

Collaborators

  • moyuyc