Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-services-injector

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-services-injector - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

.idea/modules.xml

2

package.json
{
"name": "react-services-injector",
"version": "0.0.2",
"version": "0.0.3",
"description": "A library to create and use sigleton-services in your React application.",

@@ -5,0 +5,0 @@ "main": "index.js",

React Services Injector
===================
Got tired with Redux? Really hate that ACTION_THAT_DOES_SOME_ACTION: "ACTION_THAT_DOES_SOME_ACTION"? Or maybe you are used to be an Angular-developer? So then you definitely should try some services in React!
Got tired with Redux? Really hate that `ACTION_THAT_DOES_SOME_ACTION: "ACTION_THAT_DOES_SOME_ACTION"`? Or maybe you are used to be an Angular-developer? So then you definitely should try some services in React!

@@ -29,4 +29,3 @@ Installation

return this.products.filter(product => {
return (product.name || '')
.toLowerCase()
return (product.name || '').toLowerCase()
.indexOf(this.filter.toLowerCase()) === 0;

@@ -75,14 +74,14 @@ }) || [];

this.addRandomProduct = this.addRandomProduct.bind(this);
this.addRandomProduct = this.addRandomProduct.bind(this);
}
addRandomProduct() {
addRandomProduct() {
this.services.storage.addProduct({
name: 'Test product',
price: Math.floor(Math.random() * 250) + 50
name: 'Test product',
price: Math.floor(Math.random() * 250) + 50
});
}
}
render() {
let {storage} = this.services;
let {storage} = this.services;

@@ -92,3 +91,3 @@ return (

{storage.getFiltered().map((product, index) =>
<Product key={index} data={product} />
<Product key={index} data={product} />
)}

@@ -109,21 +108,21 @@

===
####Singletons
#### Singletons
Services are singletons, so you can use your service in multiple components with the same data.
####Asynchronous actions
#### Asynchronous actions
If you want to do some asynchronous stuff if your service, please use `this.$update()` after it is done (remember `$scope.$apply()`, huh?) For example:
```javascript
addProduct({name, price}) {
setTimeout(() => {
this.products.push({category, name, price, stocked});
setTimeout(() => {
this.products.push({category, name, price, stocked});
this.$update(); //here is it
}, 200);
this.$update(); //here is it
}, 200);
}
```
####Only ES6 classes
#### Only ES6 classes
It is already 2017, right? Please, use ES6 classes instead of `React.createComponent` (especially as even React says that method is deprecated). Also, the library won't connect your functional components -- create a class if you want to use services there.
####Troubleshooting
#### Troubleshooting
Please, feel free to create an issue any time if you found a bug or unexpected behavior.
Feature requests are pretty much acceptable too.
Feature requests are pretty much acceptable too.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc