V
V
volucris12021-03-25 13:34:48
Web development
volucris1, 2021-03-25 13:34:48

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")
)


So, if I don’t import into React in the first code, then everything doesn’t work, when I connect, everything works, how can I change React’s persistent connection

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Lewandowski, 2021-03-25
@volucris1

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 question

Ask a Question

731 491 924 answers to any question