DEV Community

Discussion on: can't declare url and path variables useRouteMatch in class

Collapse
 
sergiodxa profile image
Sergio Daniel Xalambrí

React Hook can’t be used in class based components, but what you can do is to create a function component where you call the hook and pass the returned value to your class based component as a prop, create a HOC or Render Prop from the hook for example, then you will be able to receive those values in your class based component.