reactjs - 单元测试时如何通过{history, location, match}
问题描述
我正在针对以下组件运行测试:
const App: React.FC<RouteComponentProps> = ({ history, location, match }) => { ... }
所有的测试都通过了,但是我收到了这个警告:
const { getByText, debug } = render(<MemoryRouter><Route><App/></Route></MemoryRouter>);
Type '{}' is missing the following properties from type 'RouteComponentProps<{}, StaticContext, {}>': history, location, match(2739)
我的印象是<MemoryRouter>
&<Route>
会提供<App/>
缺失的属性......
解决方案
推荐阅读
- bash - Bash中“if”条件中的“cd”在“if”之后不会更改当前目录
- ruby-on-rails - Google Oauth2 在 Google 域上失败
- machine-learning - 卷积运算的意外结果
- ruby - 在数组中打印奇数
- c# - 配置Window Service Base Path并读取环境变量
- wpf - 在列表列表中查找选中项目的列表
- https - 使用 HTTPS 和子域进行托管
- python - 如何通过键事件绑定更新 tkinter 类中的图像?
- python - 从 ARIMA 模型中获取结果
- java - Matlab Compiler Runtime安装文件找不到Java Runtime Environment