Answer the question
In order to leave comments, you need to log in
How to avoid importing react in every .jsx?
I have 2 files:
class Hello extends React.Component {
render() {
return <h1>Hello, </h1>;
}
}
export default Hello;
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import Hello from './anketa.jsx';
ReactDOM.render(
<Hello />,
document.getElementById("root")
)
Answer the question
In order to leave comments, you need to log in
1. Use a plugin for your builder that will automatically insert imports;
2. Or move to React 17 ( Introducing the New JSX Transform ).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question