I Have 2 modules once known as App and another where I create exportable variables, in one of the exportable variables i want it to change the state inside of App. please advice me it will be much appreciated.
import "./styles.css";
import {submit} from "./ex"
export default function App() {
const [loading,notLoading] = ("false")
return (
<div className="App">
<button onClick={submit}> click me </button>
</div>
);
}
// Exportable module ex.js
const objectFunc = (data) => {
return dummy(data)
}
const dummy = (e) => {
if(e === "k") {
poster(e)
} else {
console.log("failed")
}
}
const poster = (e) => {
// need to update state from this function
console.log(e,"posted")
}
// submit function - called when submitted.
export const submit = (e) => {
objectFunc("ek")
}