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

rn-launch

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rn-launch

react-native 的redux框架

  • 0.0.4
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

rn-launch

react-native 的redux框架

使用方法

  • 定义reducer和action
import {fromJS} from 'immutable'
import {handleActions} from "rn-launch"

export function actions(store) {
    return {
        getData(name) {
            return {
                type: "UPDATE_NAME",
                name,
            }
        }
    }
}

export function reducer() {
    let initialData = fromJS({
        name: "李四",
        age: 26,
    });


    return handleActions({
        UPDATE_NAME(state, {name}) {
            return state.set("name", name);
        }
    }, initialData);
}
import React,{Component} from 'react';
import {Router, Scene, Stack,} from 'react-native-router-flux';
import {reducer as appReducer,actions as appActions} from './reducer';
import Launch,{Connect} from "rn-launch"

import {
    View,
    Text,
    TouchableHighlight,
} from 'react-native';

@Connect((state)=>{
    return state.app.toJS();
})
class Home extends Component{
    render(){
        let {name,age,actions}=this.props;
        return <TouchableHighlight onPress={()=>{
               actions.getData("新名字")
           }}>
           <Text>{name}  {age}</Text>
       </TouchableHighlight>
    }
}

//启动ReactNative
AppRegistry.registerComponent('MyReactNativeApp', () => Launch({
    app: appReducer
}, {
    app: appActions
}, <Router>
   <Stack key="root">
       <Scene  key="home" component={Home} title="Home"/>
   </Stack>
</Router>));

FAQs

Package last updated on 06 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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