Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
106 views
in Technique[技术] by (71.8m points)

javascript - Error While using Material UI within React

I was following a youtube tutorial about building an app in React JS. https://www.youtube.com/watch?v=ngc9gnGgUdA

In that tutorial I created an App as described in it [time stamp: https://youtu.be/ngc9gnGgUdA?t=1993].

import React from 'react';
import {Container, AppBar, Typography, Grid, Grow} from '@material-ui/core';
import memories from './images/memories.png'



const App = ()=>{
    return (
        <Container maxidth='lg'>
            <AppBar position='static' color="inherit">
                <Typography variant='h2' align="center">Memories</Typography>
                <img src={memories} alt='memories' height='60' />
            </AppBar>
        </Container>
        
    );
}
export default App;

But I am getting this error,

Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:

  1. You might have mismatching versions of React and the renderer (such as React DOM)
  2. You might be breaking the Rules of Hooks
  3. You might have more than one copy of React in the same app See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.

I am beginner I may not have covered everything regarding problem statement, please ask if you require further information regarding my problem.

question from:https://stackoverflow.com/questions/65640749/error-while-using-material-ui-within-react

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...