{"id":21712515,"url":"https://github.com/youfoundron/react-redux-connect-helpers","last_synced_at":"2026-03-02T02:34:20.022Z","repository":{"id":57343219,"uuid":"78960239","full_name":"youfoundron/react-redux-connect-helpers","owner":"youfoundron","description":"Helpful set of functions for connecting redux state to react components.","archived":false,"fork":false,"pushed_at":"2017-04-18T00:56:24.000Z","size":89,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T18:04:43.475Z","etag":null,"topics":["react","redux"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/youfoundron.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-14T19:01:59.000Z","updated_at":"2021-10-31T01:10:48.000Z","dependencies_parsed_at":"2022-09-12T07:00:16.146Z","dependency_job_id":null,"html_url":"https://github.com/youfoundron/react-redux-connect-helpers","commit_stats":null,"previous_names":["rongierlach/react-redux-connect-helpers"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youfoundron%2Freact-redux-connect-helpers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youfoundron%2Freact-redux-connect-helpers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youfoundron%2Freact-redux-connect-helpers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youfoundron%2Freact-redux-connect-helpers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/youfoundron","download_url":"https://codeload.github.com/youfoundron/react-redux-connect-helpers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248610346,"owners_count":21132921,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["react","redux"],"created_at":"2024-11-25T23:39:43.759Z","updated_at":"2026-03-02T02:34:14.973Z","avatar_url":"https://github.com/youfoundron.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Redux Connect Helpers\n\nA helpful set of functions for connecting redux state to react components.  \nCompose your connectors at will and build the connected component of your dreams... 😴\n\n[![Build Status](https://travis-ci.org/rongierlach/react-redux-connect-helpers.svg?branch=master)](https://travis-ci.org/rongierlach/react-redux-connect-helpers) [![Dependency Status](https://david-dm.org/rongierlach/react-redux-connect-helpers.svg)](https://david-dm.org/rongierlach/react-redux-connect-helpers) [![devDependency Status](https://david-dm.org/rongierlach/react-redux-connect-helpers/dev-status.svg)](https://david-dm.org/rongierlach/react-redux-connect-helpers#info=devDependencies) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)  \n\n## Installation\n\n`$ npm install react-redux-connect-helpers`\n\n## Usage\n```javascript\nimport React from 'react'\nimport { compose } from 'react-redux'\nimport {\n  connectValue,\n  connectStateValue,\n  createActionConnector\n} from 'react-redux-connect-helpers'\n\n// 1. Given a component we wish to connect to state\nconst ButtonWithText = props =\u003e\n  \u003cbutton\n    className={props.active ? 'active' : ''}\n    onClick={props.onClick}\n  \u003e\n    {props.text}\n  \u003c/button\u003e\n\n// 2. And action creators to be bound to dispatch (optional)\nconst actionCreators = {\n  toggleMenuActiveState: () =\u003e ({\n    type: 'TOGGLE_MENU_ACTIVE_STATE',\n    payload: null\n  })\n}\n\n// 3. We can connect property 'text' as value 'Menu'\nconst textProp = connectValue('Menu', 'text')\n\n// 4. We can connect property 'active' as value at state.menu.active\nconst activeProp = connectStateValue(['menu', 'active'], 'active')\n\n// 5. We can create an action connecting helper for our actionCreators\nconst connectAction = createActionConnector(actionCreators)\n\n// 6. And then connect property 'onClick' as a bound action creator toggleMenuActiveState\nconst onClickProp = connectAction('toggleMenuActiveState', 'onClick')\n\n// 7. Finally, we can connect our component with all the desired props\nconst ToggleMenuButton = compose(\n  textProp\n  activeProp,\n  onClickProp\n)(ButtonWithText)\n\nexport default ToggleMenuButton\n```\n\n## Immutable\nIf your redux store uses \u003ca href=\"https://facebook.github.io/immutable-js/\"\u003eImmutable.js\u003c/a\u003e, import with `react-redux-connect-helpers/immutable`\n\n## API Reference\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n### connectStateValue\n\nReturns a function that connects a value in state to a React component as a prop\n\n**Parameters**\n\n-   `pathArray` **([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)\u0026lt;[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)\u003e | [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String))**\n-   `propName` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**\n-   `transformValue` **[function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)**\n\n**Examples**\n\n```javascript\nconst BandContainer = compose(\n  connectStateValue('name'),\n  connectStateValue(['musicians'], 'members'),\n  connectStateValue(\n    ['discography', 'albumsByYear'],\n    'firstThreeAlbums',\n    (albumsByYear, state) =\u003e albumsByYear.slice(0, 3)\n  )\n)(BandComponent)\n```\n\nReturns **[function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** Connected component class\n\n### connectValue\n\nReturns a function that connects a value to a React component as a prop\n\n**Parameters**\n\n-   `value` **any**\n-   `propName` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**\n\n**Examples**\n\n```javascript\nconst TitleContainer = compose(\n  connectValue('purple', 'color'),\n  connectValue('You\\'re Living All Over Me', 'title')\n)(TitleComponent)\n```\n\nReturns **[function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** Connected component class\n\n### createActionConnector\n\nA higher order function that returns a function to connect bound actions to React components as props\n\n**Parameters**\n\n-   `actionCreators` **[object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**\n\n**Examples**\n\n```javascript\nconst actionCreators = { purchaseAlbum, ... }\nconst connectAction = createActionConnector(actionCreators)\nconst PurchaseButton = compose(\n  connectAction('purchaseAlbum', 'onClick')\n)(ButtonComponent)\n```\n\nReturns **[function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)** Helper to connect an action\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoufoundron%2Freact-redux-connect-helpers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyoufoundron%2Freact-redux-connect-helpers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoufoundron%2Freact-redux-connect-helpers/lists"}