我正在使用 React、Redux、Redux-Form 和 TypeScript 开发应用程序。我正在努力使用由包 @types/redux-form (绝对类型)定义的类型,尤其是 FieldArray。有一个属性“组件”,我在其中传递了对组件的引用,但我不知道在描述它的道具时应该使用什么类型。我从Redux-Form 存储库下载了使用 FieldArray 的示例,并稍微修改了它以使用 TypeScript。我想用 compilerOption "noImplicitAny": true 编译它。所以这里是 FieldArraysForm.tsx(类似于官方示例):
import * as React from 'react';
import { Field, FieldArray, reduxForm } from 'redux-form';
import validate from './validate';
const renderField = (props) => {
const { touched, error } = props.meta;
const { input, label, type } = props;
return (
<div>
<label>{label}</label>
<div>
<input {...input} type={type} placeholder={label} />
{touched && error && <span>{error}</span>}
</div>
</div>
) …Run Code Online (Sandbox Code Playgroud) 我使用的是MS SQL Server,我有3个表,A,B和C.A和B都有名为Id的列.我想在C中插入每个组合的值,所以假设表A有数据:
Id
1
2
3
Run Code Online (Sandbox Code Playgroud)
表B有数据:
Id
4
5
Run Code Online (Sandbox Code Playgroud)
我试图让表C有数据:
Id | A_Id| B_Id
1 |1 | 4
2 |1 | 5
3 |2 | 4
4 |2 | 5
5 |3 | 4
6 |3 | 5
Run Code Online (Sandbox Code Playgroud)
我将非常感谢任何帮助.