New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-hookify

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-hookify

A CLI tool to convert React class components into functional components with hooks

npmnpm
Version
1.0.9
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

ReactHookify

React Hookify is a command line tool that converts React class components into functional components with Hooks! Documentation: https://react-hookify.herokuapp.com/

It will not alter your current file; instead, a new 'hookified' file is created next to your original.

Setup

  • npm install -g react-hookify

Usage

  • hookify <filepath(s) of class component>
  • Examples:
    • hookify client/app.js
    • hookify app.js
    • hookify app1.js app2.js
  • Look for your new 'hookified' file in the same directory as your class component file!

Limitations

  • React Hooks cannot always map 1 to 1 with lifecycle components. Less complex lifecycle components should work fine with React Hookify. In more complex cases, code my have to be rewritten
    • Currently, the only supported lifecycle methods are componentDidMount, componentDidUpdate, and componentWillUnmount
  • Any comments in the original file will be removed in the 'hookified file'
  • React Hookify does not currently support 'get', 'set', and 'static' keywords

FAQs

Package last updated on 20 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts