gpt4 book ai didi

javascript - 更新以响应 16.2.0 时的碎片不起作用

转载 作者:行者123 更新时间:2023-11-30 14:49:25 25 4
gpt4 key购买 nike

我将我的 React 版本更新到 16.2.0,并使用 Fragment 来包装一些组件。所以我写:

import React from 'react;

然后我写:

const CustomerSearch = () => (
<React.Fragment>
<Field
id="lastname"
name="lastname"
floatingLabelText="ΕΠΩΝΥΜΟ"
floatingLabelStyle={styles.floatingLabelStyle}
floatingLabelFocusStyle={styles.floatingLabelFocusStyle}
underlineStyle={styles.underlineStyle}
underlineFocusStyle={styles.underlineFocusStyle}
component={InputTextField}
/>
<br />
<Field
id="firstname"
name="firstname"
floatingLabelText="ΟΝΟΜΑ"
floatingLabelStyle={styles.floatingLabelStyle}
floatingLabelFocusStyle={styles.floatingLabelFocusStyle}
underlineStyle={styles.underlineStyle}
underlineFocusStyle={styles.underlineFocusStyle}
component={InputTextField}
/>
<br />
<Field
id="companyName"
name="companyName"
floatingLabelText="ΟΝΟΜΑ ΕΤΑΙΡΕΙΑΣ"
floatingLabelStyle={styles.floatingLabelStyle}
floatingLabelFocusStyle={styles.floatingLabelFocusStyle}
underlineStyle={styles.underlineStyle}
underlineFocusStyle={styles.underlineFocusStyle}
component={InputTextField}
/>
<br />
<Field
id="mobile"
name="mobile"
floatingLabelText="ΚΙΝΗΤΟ"
floatingLabelStyle={styles.floatingLabelStyle}
floatingLabelFocusStyle={styles.floatingLabelFocusStyle}
underlineStyle={styles.underlineStyle}
underlineFocusStyle={styles.underlineFocusStyle}
component={InputTextField}
/>
<br />
<Field
id="generatorSN"
name="generatorSN"
floatingLabelText="GENERATOR SN"
floatingLabelStyle={styles.floatingLabelStyle}
floatingLabelFocusStyle={styles.floatingLabelFocusStyle}
underlineStyle={styles.underlineStyle}
underlineFocusStyle={styles.underlineFocusStyle}
component={InputTextField}
/>
<br />
</React.Fragment>
)

export default CustomerSearch

但我收到一个错误:

Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in. Check the render method of CustomerSearch.

为什么会这样?我使用了一个 div,它运行良好。谢谢

最佳答案

问题出在依赖项上。我跑了 npm install npm@latest -g我的问题已解决 :)

关于javascript - 更新以响应 16.2.0 时的碎片不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48405132/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com