我试图在18.1.0中使用antd and antd的表组件,即使我可以在版本17中成功成功
我正在尝试使用 ant Design Table 在18.1.0中。但是,当我按照文档中规定的使用
&lt;表列= {columns} dataSource = {data} /&gt; < /code>
我已经排除了所有所有内容显而易见的事情(从API中获取数据时,我确实使用了列和数据
。 ),这不是渲染。
如果我在该表组件的返回中将其他类似“测试”之类的东西呈现,则可以很好地呈现。我认为我已经将其缩小到17和18版本之间的差异:
它将在index.js中使用reactdom.render
在17.xx中起作用(这实际上是代码之间的唯一更改我在17 vs 18中,组件的代码在两者中都是相同的)。
但是我无法使用ReactDom.render。 :
const root = reactdom.createOt(document.getElementById('root'));
root.render
,但它不会呈现antd的表格comp数据。 我不知道如何修复。我假设我以某种方式需要更改18的index.js,所以它会从ANTD的表Comp中呈现数据吗?
任何想法都非常感谢。
I'm trying to use ant design table in 18.1.0. However I can't get the table to render when I use it as prescribed in the documentation
<Table columns={columns} dataSource={data} />
I've ruled out all of the obvious things (I did use columns and data earlier when grabbing the data from the API, etc.)
I'm actually getting no errors at all when running it in localhost (npm start launches fine, no browser or VS code terminal warnings or errors), it's just not rendering.
If I put something else like 'testing' in the return for that table component, it renders just fine. I think I've narrowed it dow to the difference between react 17 and 18 versions:
it'll work in 17.x.x. using ReactDOM.render
in index.js (that's literally the only change between the code I have in 17 vs 18, the component's code is identical in both).
but I can't use ReactDOM.render in 18. when I tried it, it shows error that 18 doesn't support ReactDOM.render ).so it seems I have to use 18's way of rendering?:
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render
But again, it won't render antd's table comp data.
I have no clue how to fix. I assume I somehow need to change 18's index.js so it'll render data from antd's table comp?
Any ideas are much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论