我正在尝试使用create
fromreact-test-renderer
来渲染组件。这就是我想要做的
import { ReactTestRenderer, create} from 'react-test-renderer';
let component: ReactTestRenderer;
const createComponent = (tradingBalances: IBalance[]) => {
component = create(<StakingContainer tradingBalances={tradingBalances} vaultBalances={mockVaultBalances} prices={mockPrices} />);
};
但我不断收到此错误:
SyntaxError: .../path/... Unexpected token, expected "," (31:41)
29 | let instance: ReactTestInstance;
30 | const createComponent = (tradingBalances: IBalance[]) => {
> 31 | component = create(<StakingContainer tradingBalances={tradingBalances} vaultBalances={mockVaultBalances} prices={mockPrices} />);
| ^
32 | };
为什么?我错过了什么?