mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
WIP optimize connect with redux state in preferences pages.
This commit is contained in:
16
client/src/containers/Currencies/withCurrency.js
Normal file
16
client/src/containers/Currencies/withCurrency.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
getCurrencyById,
|
||||
getCurrencyByCode,
|
||||
} from 'store/currencies/currencies.selector';
|
||||
|
||||
|
||||
const mapStateToProps = (state, props) => ({
|
||||
...(props.currencyId) ? {
|
||||
currency: getCurrencyById(state.currencies.data, props.currencyId),
|
||||
} : (props.currencyCode) ? {
|
||||
currency: getCurrencyByCode(state.currencies.data, props.currencyCode),
|
||||
} : {},
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps);
|
||||
Reference in New Issue
Block a user