UNPKG

react-hookify

Version:

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

14 lines (11 loc) 369 B
const { getInsideOfFunc } = require('./commonUtils') function handleRender(classDetails) { const { classCompInString } = classDetails let renderIdx = classCompInString.search(/(render\()/) let renderSlice = classCompInString.slice(renderIdx) let returnSlice = getInsideOfFunc(renderSlice, 'render') return returnSlice } module.exports = { handleRender, }