javascript - react component uses super() to report errors
漂亮男人
漂亮男人 2017-07-05 10:57:48
0
4
781

The project requires react, so I followed the official website and Ruan Yifeng’s tutorials to learn
The code is as shown:

The following is a reference to react, which is from The three files copied directly from Ruan Yifeng's demo

The following is the error reported to super after running. Is this because there is something missing in the referenced file?

漂亮男人
漂亮男人

reply all(4)
滿天的星座

Because you didn’t pass any props, the props are undefined, so super() should be used here.

为情所困

One less babel, class xxx extends React is written in es6 and needs to be escaped.
You can download it and quote it locally.

    <script src="https://cdn.bootcss.com/babel-standalone/6.22.1/babel.min.js"></script>
typecho

The correct answer upstairs, super() will not report an error if it does not take the props parameter

洪涛

For those of you who don’t read in English 0_0

Don’t this error mean super undefined? Who is super? Component constructor wow

Look at the poster using React.component instead of React.Component

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!