es module observable error "could not be converted"
See original GitHub issuehi!
i’m trying to set up a modern build-free app using mobx, htm, preact, and native es modules
i get an error when i try to use observable
esmodule (codepen)
-
import {observable} from "https://unpkg.com/mobx@5.9.0/lib/mobx.es6.js" observable("anything")
error
-
Uncaught Error: [mobx] The provided value could not be converted into an observable. If you want just create an observable reference to the object use 'observable.box(value)' invariant$$1 @ mobx.es6.js:16 fail$$1 @ mobx.es6.js:11 createObservable @ mobx.es6.js:402 (anonymous) @ pen.js:4
i don’t know what’s wrong
I have a:
- Issue:
- Provide error messages including stacktrace
-
Uncaught Error: [mobx] The provided value could not be converted into an observable. If you want just create an observable reference to the object use 'observable.box(value)' invariant$$1 @ mobx.es6.js:16 fail$$1 @ mobx.es6.js:11 createObservable @ mobx.es6.js:402 (anonymous) @ pen.js:4
-
- Provide a minimal sample reproduction. Create a reproduction based on this sandbox
- its only two lines but i have this codepen
- Did you check this issue wasn’t filed before?
- Elaborate on your issue. What behavior did you expect?
- i expected
observable
not to throw an error for primitives like strings or numbers
- i expected
- State the versions of MobX and relevant libraries. Which browser / node / … version
mobx@5.9.0
,chrome@71.0
- Provide error messages including stacktrace
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Error in importing Observable from 'rxjs/Observable' in angular 4
But in another question from Stack, i read that way will increase the page load (Best way to import Observable from rxjs).
Read more >Export final code? - Community Help - The Observable Forum
You can convert your Observable notebook to a standard ES module (by hand for now), but since ES imports aren't reactive and don't...
Read more >HTTP Example with Observables • Angular - codecraft.tv
So the map operator isn't converting a string to SearchItem[] it's converting a string to Observable<SearchItem[]> . So the subscribe function is receiving ......
Read more >Error codes - CKEditor 5 Documentation
Error codes. CKEditor 5 Framework logs errors and warnings to the console. The following list contains more detailed descriptions of those issues.
Read more >toPromise - Learn RxJS
Convert observable to promise. ... ⚠ toPromise is not a pipable operator, as it does not return an observable.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@chase-moskal The target of
observable
should be an object. If you wanna observe a primitive value, please useobservable.box
, see details here.@chase-moskal I’m a beginner here, but isn’t this what the documentation says?
The string
"anything"
is immutable and thereforeA primitive-valued field is a different story.