Auto importing `react` using Webpack’s ProvidePlugin

31 Jul

Auto importing `react` using Webpack’s ProvidePlugin

Every time we write react component,  we end up importing React from react. To avoid this:

import React from ‘react’

Check in line 18, with Webpack’s ProvidePlugin:

This would import Reactwhenever the identifier ‘React’ is declared in your code.

Bydr.code.skm

I am backend developer with passion in Web Application development using latest technologies like Laravel, PHP7, React, ECMAScript 6 and WordPress. I prefer spending time analyzing big data with Apache Spark. Apart from that, I do photography.