HenryNguyen5 f39787152e Fix Miscellaneous Types (#635)
* Add repo wide prettier command to prepush

* Make config file explict, remove formatAll to prepush

* Fix react router typings

* Add more typings

* Fix event typings,  fix transition children
2017-12-19 16:46:34 -06:00

28 lines
841 B
TypeScript

import React, { Component } from 'react';
import { Query } from './Query';
import { connect } from 'react-redux';
import { AppState } from 'reducers';
import { getTokens, MergedToken } from 'selectors/wallet';
interface Props {
tokens: MergedToken[];
withQuery({ token }: { token: MergedToken | null | undefined }): React.ReactElement<any>;
}
class TokenQueryClass extends Component<Props, {}> {
public render() {
return (
<Query
params={['tokenSymbol']}
withQuery={({ tokenSymbol }) => this.props.withQuery(this.paramGetter(tokenSymbol))}
/>
);
}
private paramGetter = (unit: string | null) =>
unit ? { token: this.props.tokens.find(t => t.symbol === unit) } : { token: null };
}
export const TokenQuery = connect((state: AppState) => ({
tokens: getTokens(state)
}))(TokenQueryClass);