tonyhb / redux-ui

Easy UI state management for react redux
636 stars 58 forks source link

redux-ui with redial #64

Open walshe opened 7 years ago

walshe commented 7 years ago

a relative newbie here to react , redux and redial..

If I am already using redial in a component (see below) how can I also use redux-ui (in the non decorator fashion) at the same time? I am already using provideHooks at the bottom of the file :

`import { provideHooks } from 'redial' import React, { PropTypes } from 'react' import { loadUnlistedVins, loadFilterData } from '../actions' import { connect } from 'react-redux' import UnlistedVinsFilter from '../components/UnlistedVinsFilter'

import YearFilter from '../components/YearFilter'

import { StyleSheet, css } from 'aphrodite' import Helmet from 'react-helmet' import { selectUnlistedVins } from '../unlistedVinsReducer' import { getFilterData } from '../filterDataReducer'

const redial = {

/**

const mapStateToProps = state => ({ unlistedVins: selectUnlistedVins(state), })

const UnlistedVinsListPage = ({ unlistedVins }) => (



{ unlistedVins.isLoading && } {!unlistedVins.isLoading && unlistedVins.unlistedVins.data && unlistedVins.unlistedVins.data.map((unlistedVin, i) => ) }
selectListingSubjectLineModelIDYearTrimLevelMilesSuggestedBuyItNowPriceVINListingSiteRegionBrandStatusLocationDate
Loading...
{unlistedVin.ListingSubjectLine}{unlistedVin.ModelID}{unlistedVin.Year}{unlistedVin.TrimLevel}{unlistedVin.Miles}{unlistedVin.SuggestedBuyItNowPrice}{unlistedVin.VIN}??????????????????

)

UnlistedVinsListPage.PropTypes = { unlistedVins: PropTypes.array.isRequired

}

const styles = StyleSheet.create({ root: { maxWidth: 500 }, title: { fontSize: 28, margin: '0 auto 1.5rem', color: '#b7b7b7' } })

export default provideHooks(redial)(connect(mapStateToProps)(UnlistedVinsListPage)) `

satchelspencer commented 7 years ago

you're already wrapping two higher order components (connect and provideHooks):

export default provideHooks(redial)(
  connect(mapStateToProps)(
    UnlistedVinsListPage
  )
)

do the same with ui

export default provideHooks(redial)(
  connect(mapStateToProps)(
    ui(someUiParams)(
      UnlistedVinsListPage
    )
  )
)