React errors and solutions

报错信息
Super expression must either be null or a function, not undefined

class Fruit extends React.component{
    
    
    render(){
    
    
        return <div>
            <Data name="orange"/>
            <Data name="apple"/>
            <Data name="watermelon"/>
        </div>
    }
}
const elem = <Fruit/>
ReactDOM.render(
    elem,
    document.getElementById("area")
)

Obviously it was a problem during inheritance. Later, it was discovered that the C of the component was not capitalized. The component did not inherit from React.Component. If you encounter this situation, you can see if you have spelling errors.

报错信息
The tag xxxxxx is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter.

The reason for the error is that the component did not follow the React specification when the component was packaged. React did not recognize that this was a component. This error occurred because the component name was not capitalized.

Error message
Unknown DOM property class. Did you mean className?

Check if the tag has className written as class

The error message
Could not find a required file.
Name: index.js.js
Here I am configuring the application to the page

I wrote it like this in the path

  appIndexJs: resolveModule(resolveApp, 'src/index.js'),

Later, I found out that the scaffolding will help you add the suffix, so when he looks for the entry file, he will look for index.js.js. Naturally, this file will not be in my project.

Solution: remove the .js suffix

Guess you like

Origin blog.csdn.net/weixin_38987500/article/details/106792331