I know you can call static class method like this, but how would you achieve the same if it was not class but a function component.
import ReactDOM from "react-dom";
import "./styles.css";
class App extends Component {
static staticMethod() {
alert( 'static method has been called.');
}
render(){
return <h1>hi</h1>
}
}
App.staticMethod()
What I would like to achieve is call testMethod from outside of react component.
import React from "react";
import ReactDOM from "react-dom";
function App (props) {
const testMethod = () => {
return props.test
}
return( <h1>hi</h1>)
}
//not workoing
//App.testMethod();