{"library":"redux-view","title":"redux-view","description":"A view wrapper for Redux and React-Router that simplifies mapping between routes, handling data fetching on route transitions, and navigating from dispatch functions. Current stable version is 0.2.1 (last released in 2016). Release cadence is low/unmaintained. Key differentiators: provides initialize/terminate lifecycle hooks that work even when routes share the same component (solving a common react-router gotcha), and injects the router as a third parameter to mapDispatchToProps for easy navigation. Requires react-redux 4.x, react-router >=2.0.0 or ^4.0.0-alpha.0, and lodash 4.x.","language":"javascript","status":"deprecated","last_verified":"Fri May 01","install":{"commands":["npm install redux-view"],"cli":null},"imports":["import ReduxView from 'redux-view'","class MyView extends ReduxView { ... }","class MyView extends ReduxView { initialize = ({ dispatch }) => { ... } }"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import ReduxView from 'redux-view';\nimport { createStore, combineReducers } from 'redux';\nimport { Provider } from 'react-redux';\nimport { BrowserRouter, Route } from 'react-router-dom';\nimport React from 'react';\nimport { render } from 'react-dom';\n\nclass HomeView extends ReduxView {\n  container = ({ message }) => <h1>{message}</h1>;\n  initialize = ({ dispatch }) => {\n    dispatch({ type: 'SET_MESSAGE', payload: 'Welcome!' });\n  };\n  mapStateToProps = (state) => ({\n    message: state.message,\n  });\n}\n\nconst reducer = (state = { message: '' }, action) => {\n  switch(action.type) {\n    case 'SET_MESSAGE': return { ...state, message: action.payload };\n    default: return state;\n  }\n};\n\nconst store = createStore(combineReducers({ message: reducer }));\n\nconst App = () => (\n  <Provider store={store}>\n    <BrowserRouter>\n      <Route path=\"/\" component={HomeView} />\n    </BrowserRouter>\n  </Provider>\n);\n\nrender(<App />, document.getElementById('root'));","lang":"javascript","description":"Basic usage: extending ReduxView class, defining container, initialize, and mapStateToProps, then rendering with react-redux Provider and react-router Route.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}