Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+14 votes

Here is the error message I'm getting: "React Hook "useStyles" cannot be called in a class component. React Hooks must be called in a React function component or a custom React Hook function"

I don't know much about react hooks, so any help is appreciated.

asked in CSC490_Spring202021 by (893 points)
+1

Are you trying to use the hook in a different component?

1 Answer

+3 votes

No, hook only for function.
if you need something like props, you can do it like this:
function something(props){
.....
}
export default something;

answered by (2.2k points)
...