Skip to content

Commit

Permalink
feat(cta-interest): moved pure component to be functional component
Browse files Browse the repository at this point in the history
  • Loading branch information
milan-bc committed Feb 18, 2021
1 parent 8a632d7 commit ee9c9da
Showing 1 changed file with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
import { bindActionCreators, Dispatch } from 'redux'
import { connect, ConnectedProps } from 'react-redux'
import React, { PureComponent } from 'react'
import React, { useEffect } from 'react'

import { actions } from 'data'
import { RemoteDataType } from 'core/types'

import { getData } from './selectors'
import Template from './template.success'

class InterestBanner extends PureComponent<Props> {
componentDidMount () {
this.props.interestActions.fetchInterestRate()
}
render () {
return this.props.data.cata({
Success: val => <Template {...this.props} {...val} />,
Failure: () => null,
Loading: () => null,
NotAsked: () => null
})
}
const InterestBanner: React.FC<Props> = props => {
useEffect(() => {
props.interestActions.fetchInterestRate()
}, [])

return (
<>
{props.data.cata({
Success: val => <Template {...props} {...val} />,
Failure: () => null,
Loading: () => null,
NotAsked: () => null
})}
</>
)
}

const mapStateToProps = (state): LinkStatePropsType => ({
Expand Down

0 comments on commit ee9c9da

Please sign in to comment.