1
현재 Scala, Play 프레임 워크 및 React 샘플 코드로 재생 중이며 ES6 모듈 시스템을 사용하지 않고 브라우저에서로드하도록 다음 코드를 변환하는 동안 문제가 발생합니다. 즉, export default
을 사용할 수 없습니다.ES6 모듈없이 반응
export default
없이 클라이언트 측에서로드 할 수 있도록 ES6에서 다음을 다시 작성하는 방법은 무엇입니까? 이 클래스를 반올림하여 render
을 반환하는 함수로 분해해야합니까? 당신은 여기에 전체 일을 다시 작성 ... 할거야
export default function form({
fields: defaultFds = [],
validate: defaultVal =() => ({}),
} = {}) {
return (WrappedClass) => class Form extends React.Component {
static defaultProps = {
fields: defaultFds,
validate: defaultVal,
}
static childContextTypes = {
form: PropTypes.object,
fields: PropTypes.object,
}
static propTypes = {
fields: PropTypes.array,
validate: PropTypes.func,
value: PropTypes.object,
onChange: PropTypes.func,
onValidate: PropTypes.func,
}
state = {
touched: {},
errors: {},
valid: undefined,
}
render() {
const { value, onChange, onValidate, validate, fields, ...otherProps } = this.props;
return <WrappedClass {...otherProps} {...this.generatedProps()} />;
}
}
}
그래, 나는 그것을 깨달았다 :(. webpack을 통합하는 방법을 알아 냈다. – nixgadgets