WhenQueryExists.tsx
1 import React from 'react'; 2 3 import { Query, Param } from './Query'; 4 5 interface Props { 6 whenQueryExists: React.ReactElement<any> | null; 7 } 8 9 const params: Param[] = ['to', 'data', 'tokenSymbol', 'value', 'gaslimit', 'limit', 'readOnly']; 10 11 export const WhenQueryExists: React.SFC<Props> = ({ whenQueryExists }) => ( 12 <Query 13 params={params} 14 withQuery={queries => (Object.values(queries).some(v => !!v) ? whenQueryExists : null)} 15 /> 16 );