https://github.com/masylum/mobx-rest-example
Example project built with mobx-rest
https://github.com/masylum/mobx-rest-example
Last synced: about 1 year ago
JSON representation
Example project built with mobx-rest
- Host: GitHub
- URL: https://github.com/masylum/mobx-rest-example
- Owner: masylum
- Created: 2017-03-19T21:10:08.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-12-06T23:14:55.000Z (over 3 years ago)
- Last Synced: 2025-04-06T15:42:34.779Z (over 1 year ago)
- Language: JavaScript
- Size: 898 KB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# mobx-rest working example
I hacked this little project to show how to
use `mobx-rest`.
You can access the [demo here](https://demo-wiimsnkpdy.now.sh/).
To build it I did the following:
```
npm install -g create-react-app
create-react-app demo
cd demo
yarn start
```
With this you can have an up and running react app :)
Next was to install the dependencies:
```
yarn add mobx
yarn add mobx-react
yarn add mobx-rest
yarn add mobx-rest-fetch-adapter
```
After this I created the 3 stores:
- users
- todos
- comments
And you are good to go!
## Comments
### API
I'm using [JSON Placeholder](https://jsonplaceholder.typicode.com/) API to
implement this example. The API is not persistent, so only one comment can be
fakely created (always returns id 501).
### Decorators
I highly recommend for your project to use decorators since
the API is much more cleaner with them but as I showed in
this example, it's not needed to get started.