Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"sub" is not a function when calling setState function #2

Closed
alexander-chi opened this issue Jun 18, 2020 · 1 comment
Closed

"sub" is not a function when calling setState function #2

alexander-chi opened this issue Jun 18, 2020 · 1 comment

Comments

@alexander-chi
Copy link

Uncaught TypeError: sub is not a function
at jstates.js:34
at Array.map ()
at Object.setState (jstates.js:33)
at onPageLoad (index.js:9)
at index.js:3

my code looks like this :

if (readFromLocal("defaultConfig") === null) {
console.log("Setting runningConfig to globalDefaultConfig");
runningConfig.setState(globalDefaultConfig);
}

As far as I can tell the state is set successfully as I am able to then access the state using the getState method.

@alexander-chi
Copy link
Author

Whoops! my fault!

when subscribing I had included the brackets like so :
runningConfig.subscribe(runningConfigOnUpdate());

the proper form should have been

runningConfig.subscribe(runningConfigOnUpdate);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant