我从代码中收到上述错误:
<EditableContainer handleFn={this.onSaveTitle} component={FieldStyle}>{props.child}</EditableContainer>
class EditableContainer extends React.Component<any, any> {
render () {
const {children, ...rest} = this.props
const {edit} = this.state
if (edit) {
return (
<Component
autoFocus
onBlur={this.handleBlur.bind(this)}
value={this.state.children}
onChange={this.handleOnChange}
render={(props) => this.props.component.render(props)}
/>
)
}
}
class FieldStyle extends React.Component<any, any> {
render () {
const {autoFocus, ...rest} = this.props
// auto focus
const ref = autoFocus ? (ref) => { this.ref = ref } : null
return (
<TextField
ref={ref}
type="text"
{...rest}
/>
)
}
}
正如你所看到的,我试图使用带有propEditableContainer的 React 来指定应该从哪个组件加载到实际组件本身。但是,我收到错误。Componentcomponent
我究竟做错了什么?
RISEBY
相关分类