Reactjs 将值传递给JS

Reactjs 将值传递给JS,reactjs,typescript,Reactjs,Typescript,我想将值传递给Modal,但我无法这样传递: 我的情态: const AmountToPayModal = (dollar: number = 0) => ( <Container> <Title> <FormattedMessage id="creditPagePayment" /> </Title> <Line /> <SectionLabel> &l

我想将值传递给Modal,但我无法这样传递:

我的情态:

const AmountToPayModal = (dollar: number = 0) => (
  <Container>
    <Title>
       <FormattedMessage id="creditPagePayment" />
    </Title>
    <Line />
    <SectionLabel>
       <FormattedMessage id="creditPageNoCreditRequest" />
     </SectionLabel>
     <AmountLabel>
      <span>&#36; {dollar}</span>
     </AmountLabel>
    <SupportSpan>
       <SupportLabel>
         <FormattedMessage id="creditPagePaymentQuest" />
        </SupportLabel>
     </SupportSpan>
   </Container>
);
const amounttopaymodel=(美元:数字=0)=>(
$;{美元}
);
我的演示者:

import * as React from 'react';
import * as COLORS from '../../../constants/colors';
import styled from 'styled-components';
import AmountToPayModal from 
'../../../components/DataPayment/AmountToPayModal';

const Presenter = () => (
  <Container>
    <AmountToPayModal dollar={1600}/> /* Error here */
  </Container>
);

const Container = styled.div`
   background-color: ${COLORS.bgLightGrey};
`;

export default Presenter;
import*as React from'React';
从“../../../constants/COLORS”导入*作为颜色;
从“样式化组件”导入样式化;
从导入amounttopaymodel
“../../../components/DataPayment/AmountToPaymodel”;
const Presenter=()=>(
/*这里出错*/
);
const Container=styled.div`
背景色:${COLORS.bgLightGrey};
`;
导出默认演示者;
错误显示:

类型“{dollar:1600;}”不可分配给类型 “内在属性和数字”。类型“{dollar:1600;}”不是 可分配给类型“Number”。 类型“{dollar:1600;}”中缺少属性“toFixed”

JS表达式在大括号中指定

<AmountToPayModal dollar={1600} />
参考资料:


您好,还是错误。请检查我上面的更新错误。
export interface ModalProps {
    dollar?: number;
}

const AmountToPayModal = (props: ModalProps = { dollar: 0 }) => (
  ...
);