Codemod verified
Regularly tested and maintained by our engineers and codemod expert community.
migration
by
Codemod
React Router/4/Move Hoc To Global Scope
Last update
Feb 18, 2025
Moves HOC calls to the global scope
Example
Before
<Router history={browserHistory}><Switch><Routepath='/'render={(props) => (<Routeexactpath='/a'component={HOC(PageComponent)}/>)}/></Switch></Router>;
After
const HOCPageComponent = HOC(PageComponent);<Router history={browserHistory}><Switch><Routepath='/'render={(props) => (<Routeexactpath='/a'component={HOCPageComponent}/>)}/></Switch></Router>;
Build custom codemods
Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community