We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Failed to compile ./src/stores/Store.js Syntax error: E:/2017/react/antd/src/stores/Store.js: Unexpected token (8:2) 6 | 7 | export default class Store { > 8 | @observable counter = 10; | ^ 9 | 10 | @observable users = []; 11 |
import { observable, when, action } from "mobx"; import axios from "axios"; import { fromPromise } from "mobx-utils"; const apiRoot = "https://jsonplaceholder.typicode.com"; export default class Store { @observable counter = 10; @observable users = []; @action increaseCounter() { this.counter += 1; } @action decreaseCounter() { this.counter -= 1; } @action fetch() { let fetchResult = fromPromise(axios.get(`${apiRoot}/users`)); // combine with when.. when(() => fetchResult.state !== "pending", () => { console.log("Got it!"); this.users = fetchResult.value.data; }); } }
The text was updated successfully, but these errors were encountered:
https://mobx.js.org/best/decorators.html
Sorry, something went wrong.
No branches or pull requests
Store.js
The text was updated successfully, but these errors were encountered: