I have a component that sets up a service and I need to receive that service in other components of my application.
Here's the setup code:
export const setupRemote = () => {
if (isRemoteAvailable) {
try {
...
const allowAppInstance = SetupConfig.start(remoteInstance);
window.setup = {
someconfig: anothercode,
code: somecode,
};
} catch (e) {
console.error(e);
}
}
};
I need to return the const allowAppInstance, and I tried to do that
export const setupRemote = () => {
if (isRemoteAvailable) {
try {
...
const allowAppInstance = SetupConfig.start(remoteInstance);
window.setup = {
someconfig: anothercode,
code: somecode,
};
return {
allowAppInstance
}
} catch (e) {
console.error(e);
}
}
};
But I can't use the return, in es-lint this error occurs -- Expected to return a value at the end of arrow function
How can I return this const to use in other parts of my application?