Decoupling React Components and Redux Connect

This page summarizes the projects mentioned and recommended in the original post on /r/codehunter

SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
surveyjs.io
featured
InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
  • react-redux

    Discontinued Official React bindings for Redux [Moved to: https://github.com/reduxjs/react-redux] (by rackt)

  • Reactjs As seen here I am trying to decouple my app's components as much as I can and make them not aware of any storage or action creator. The goal is to have them to manage their own state and call functions to emit a change. I have been told that you do this using props. Considering // Menu.jsximport React from 'react'import { className } from './menu.scss'import Search from 'components/search'class Menu extends React.Component { render () { return ( Home foo bar ) }} And // Search.jsximport React from 'react'import { className } from './search.scss'class Search extends React.Component { render () { let { searchTerm, onSearch } = this.props return ( {searchTerm} onSearch(e.target.value)} value={searchTerm} /> ) }}Search.propTypes = { searchTerm: React.PropTypes.string, onSearch: React.PropTypes.function}export default Search And reading here I see a smart use of Provider and connect and my implementation would look something like this: import { bindActionCreators, connect } from 'redux'import actions from 'actions'function mapStateToProps (state) { return { searchTerm: state.searchTerm }}function mapDispatchToProps (dispatch) { return bindActionCreators({ dispatchSearchAction: actions.search }, dispatch)}export default connect(mapStateToProps, mapDispatchToProps)(Search) Assuming I have a store handling searchTerm as part of the global state. Problem is, where does this code belongs to? If I put it in Search.jsx I will couple actions with the component and more important to redux. Am I supposed to have two different versions of my component, one decoupled and one connect()ed and have to use it? If yes what would my files tree look like? One file per component or a like a make-all-connected.js ? Answer link : https://codehunter.cc/a/reactjs/decoupling-react-components-and-redux-connect

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • A Comprehensive Guide to React State Management

    3 projects | dev.to | 12 Apr 2024
  • Beyond Redux - MobX and Zustand

    1 project | dev.to | 15 Mar 2024
  • Simple & Elegant State-Management with Zustand

    1 project | dev.to | 6 Mar 2024
  • State Management Nx React Native/Expo Apps with TanStack Query and Redux

    8 projects | dev.to | 17 Feb 2024
  • Redux 101

    6 projects | dev.to | 3 Jan 2024