New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

connect-alt

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect-alt - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"name": "connect-alt",
"version": "1.0.0",
"version": "1.0.1",
"description": "Decorator for passing Altjs store state through props",

@@ -5,0 +5,0 @@ "main": "dist/main.js",

# connect-alt
> Decorator for passing alt store state through props, heavily inspired from `react-redux::connect`
## Usage
## How to / Installation
> $ npm i -S connect-alt
1. Create a FinalStore on AltJS instance:
#### I. Create a FinalStore on AltJS instance:
```javascript
import Alt from 'alt';
import makeFinalStore from 'alt/utils/makeFinalStore';
```javascript
import Alt from 'alt';
import makeFinalStore from 'alt/utils/makeFinalStore';
class Flux extends Alt {
class Flux extends Alt {
constructor(config) {
super(config);
this.FinalStore = makeFinalStore(alt);
}
constructor(config) {
super(config);
this.FinalStore = makeFinalStore(alt);
}
export default Flux;
```
}
2. Use the decorator in your components
export default Flux;
```
```javascript
import React, { Component, PropTypes } from 'react';
import connect from 'connect-alt';
#### II. Provide flux into your app context:
@connect(({ session: { currentUser } }) => ({ currentUser })
class Example extends Component {
Use [AltContainer](http://alt.js.org/docs/components/altContainer/) for an easy integration:
static propTypes = { currentUser: PropTypes.object.isRequired }
```javascript
import { render } from 'react-dom';
import AltContainer from 'alt-container';
render() {
const { currentUser } = this.props;
import Flux from './Flux';
import App from './App';
return (
<pre>{ JSON.stringify(currentUser, null, 4)</pre>
);
}
render(<AltContainer flux={ new Flux() }><App /></AltContainer>);
```
#### III. Use the decorator in your components
```javascript
import React, { Component, PropTypes } from 'react';
import connect from 'connect-alt';
@connect(({ session: { currentUser } }) => ({ currentUser })
class Example extends Component {
static propTypes = { currentUser: PropTypes.object.isRequired }
render() {
const { currentUser } = this.props;
return (
<pre>{ JSON.stringify(currentUser, null, 4)</pre>
);
}
```
}
```
## Examples
See [isomorphic-flux-boilerplate](https://github.com/iam4x/isomorphic-flux-boilerplate) for a complete app example.
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