mobx-rest is a TypeScript library typically used in User Interface, State Container, React Native, React, Unity applications. mobx-rest has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.
An application state is usually divided into three realms:. MobX is an excellent state management choice to deal with those three realms: It allows you to represent your state as a graph while other solutions, like Redux for instance, force you to represent your state as a tree. With mobx-rest resources are implemented with all their REST actions built in (create, fetch, save, destroy, ...) so instead of writing, over and over, hundreds of lines of boilerplate we can leverage REST conventions to minimize the code needed for your API interactions.
Support
Quality
Security
License
Reuse
Support
mobx-rest has a low active ecosystem.
It has 183 star(s) with 43 fork(s). There are 6 watchers for this library.
It had no major release in the last 6 months.
There are 6 open issues and 32 have been closed. On average issues are closed in 71 days. There are 4 open pull requests and 0 closed requests.
It has a neutral sentiment in the developer community.
The latest version of mobx-rest is v2.2.5
Quality
mobx-rest has no bugs reported.
Security
mobx-rest has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
License
mobx-rest is licensed under the MIT License. This license is Permissive.
Permissive licenses have the least restrictions, and you can use them in most projects.
Reuse
mobx-rest releases are not available. You will need to build from source code and install.
Installation instructions are not available. Examples and code snippets are available.
Top functions reviewed by kandi - BETA
kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework. Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of mobx-rest
Get all kandi verified functions for this library.
mobx-rest Key Features
No Key Features are available at this moment for mobx-rest.
mobx-rest Examples and Code Snippets
No Code Snippets are available at this moment for mobx-rest.
I can't get styled components working; must be something in my setup. Here's the component:
...
ANSWER
Answered 2018-Sep-01 at 15:19
We figured out the answer in the comments together, but for those stumbling over it in the future:
The order of plugins is important. Placing styled-components BEFORE emotion resolves the conflict, since emotion plugin parses the import declarations and does its magic based on that. See the code here. styled-components plugin on the other hand parses the package name, but still uses import declaration, hence the conflict.
mobx-rest is fairly simple and its source code could be read in 5 minutes. A Model represents one resource. It's identified by a primary key (mandatory) and holds its attributes. You can create, update and destroy models in the client and then sync them with the server. Apart from its attributes, a Model also holds the state of the interactions with the server so you can react to those easily (showing loading states for instance). Initialize the model with the given attributes. An object literal that holds the default attributes of the model. {} by default. An ObservableMap that holds the attributes of the model in the client. An ObservableMap that holds the attributes of the model in the server. A pointer to a Collection. By having models "belong to" a collection you can take the most out of mobx-rest. Return the object version of the attributes. Implement this abstract method so mobx-rest knows what to use as a primary key. It defaults to 'id' but if you use something like mongodb you can change it to '_id'. Implement this abstract method so mobx-rest knows where its API points to. If the model belongs to a Collection (setting the collection attribute) this method does not need to be implemented. Return the url for that given resource. Will leverage the collection's base url (if any) or urlRoot. It uses the primary id since that's REST convention. Example: tasks.get(34).url() // => "/tasks/34". Get an array with the attributes names that have changed. Gets the current changes. If an attribute is specified, returns true if it has changes. If no attribute is specified, returns true if any attribute has changes. Commit attributes to model. This will reset the model attributes to the last committed ones. Return whether that model has been synchronized with the server or not. Resources created in the client side (optimistically) don't have an id attribute yet (that's given by the server). Get the given attribute. If the attribute does not exist, it will throw an error. If different resources have different schemas you can always use has to check whether a given attribute exists or not. Check that the given attribute exists. Update the attributes in the client. Fetches this resource's data from the server. The opposite of fetch. It takes the resource from the client and persists it in the server through the API. It accepts some attributes as the first argument so you can use it as a set + save. It tracks the state of the request using the label saving. If the model has a collection associated, it will be added into it. Tells the API to destroy this resource. When dealing with REST there are always cases when we have some actions beyond the conventions. Those are represented as rpc calls and are not opinionated. A Collection represents a group of resources. Each element of a Collection is a Model. Likewise, a collection tracks also the state of the interactions with the server so you can react accordingly. An ObservableArray that holds the collection of models. Indexes allow you to determine which attributes you want to index your collection by. This allows you to trade-off memory for speed. By default we index all the models by primaryKey but you can add more indexes that will be used automatically when using filter and find with the object form. You can query your collection by a combination of attributes that are indexed and others that are not indexed. mobx-rest will take care to sort your query in order to scan the least number of models. Initializes the collection with the given resources. Abstract method that must be implemented if you want your collection and it's models to be able to interact with the API. Abstract method that tells which kind of Model objects this collection holds. This is used, for instance, when doing a collection.create so we know which object to instantiate. Return a plain data structure representing the collection of resources without all the observable layer. Return an array with the observable resources. Helper method that asks the collection whether there is any model in it. Find a model at the given position. Find a model (or not) with the given id. If required it will raise an error if not found. Helper method that filters the collection by the given conditions represented as a key value. It's important to notice that using the object API we can optimize the filtering using indexes. Same as filter but it will halt and return when the first model matches the conditions. If required it will raise an error if not found. Returns the last model of the collection. If the collection is empty, it returns null. Adds models with the given array of attributes. Resets the collection with the given models. Remove any model with the given ids. Merge the given models smartly the current ones in the collection. It detects what to add, remove and change. Instantiates and links a model to the current collection. Add and save to the server the given model. If attributes are given, also it builds the model for you. It tracks the state of the request using the label creating. Fetch the date from the server and then calls set to update the current models. Accepts any option from the set method. Exactly the same as the model one, but at the collection level.