Skip to content

nerdlabs/jscodemods

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

jscodemods

Scripts to be used with JSCodeshift

React import namespace

Because React.js has no default export (it is not an es6 module),
it should be imported like this: import * as React from 'react';
or like this: var React = require('react');.

See here for more information.

This codemod rewrites all react imports to namespace import statements
and creates destructuring assignments on the imported namespace for named imports.

This:

import React, {Component, PropTypes} from 'react';

becomes this:

import * as React from 'react';
const {Component, PropTypes} = React;

About

Codemods to be used with JSCodeshift

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published