Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+15 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 (1 point)
+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 (1 point)
...