for example i want to add a function to return or do something like this:
export const useExample = (name) => {
const script = "hi" + " " + name;
return script
};
and i want to use it in class component so should be this:
import React from 'React'
import {useExample} from "components/utils/useExample"
class App extends React.Component {
componentDidMount(){
const hiMsg = useExample('John')
console.log(hiMsg)
}
render(){
return(
<>
<div>THIS IS AN EXAMPLE</div>
</>
)
}
}
This will give an error like this:

I know that we cannot use hooks in class components, so what is the **fix **of this issue to make the use Example works?
I just want to know how I can import external files like functions who accept parameters and do something with it, and to use this file multiple times in React class component
useExamplecall any hooks (eg,useState,useEffect)? If it doesn't, then simply change the name so that it doesn't start withuse, so the lint rule won't think it's a custom hook.use. If you do need to work with a hook, you could create a HOC component that passes the hooks return value to the class component as a propuse...implies that's what it is. Change the name if it's not a hook.