使用复杂组件进行混音
尝试包含 AG Grid https://www.ag-grid.com/react- data-grid/ 位于 Remix 项目中,但未渲染。
终端控制台或 Web 控制台没有错误,在 React 项目中工作正常。所以有一些混音和复杂的组件。已尝试从 remix-utils 中包装 ClientOnly 但没有区别。
import React, { useState } from 'react';
import { AgGridReact } from 'ag-grid-react';
import{ClientOnly } from 'remix-utils';
export default function Grid() {
const [rowData] = useState([
{make: "Toyota", model: "Celica", price: 35000},
{make: "Ford", model: "Mondeo", price: 32000},
{make: "Porsche", model: "Boxter", price: 72000}
]);
const [columnDefs] = useState([
{ field: 'make' },
{ field: 'model' },
{ field: 'price' }
])
return (
<ClientOnly>
<div className="ag-theme-alpine" style={{height: 400, width: 600}}>
<AgGridReact
rowData={rowData}
columnDefs={columnDefs}>
</AgGridReact>
</div>
</ClientOnly>
);
}
Trying to include AG Grid https://www.ag-grid.com/react-data-grid/ in a Remix project but it is not rendering.
No errors in terminal console or web console, In react project this works fine. So something with remix and complex components. Have tried wrapping in ClientOnly from remix-utils but no difference.
import React, { useState } from 'react';
import { AgGridReact } from 'ag-grid-react';
import{ClientOnly } from 'remix-utils';
export default function Grid() {
const [rowData] = useState([
{make: "Toyota", model: "Celica", price: 35000},
{make: "Ford", model: "Mondeo", price: 32000},
{make: "Porsche", model: "Boxter", price: 72000}
]);
const [columnDefs] = useState([
{ field: 'make' },
{ field: 'model' },
{ field: 'price' }
])
return (
<ClientOnly>
<div className="ag-theme-alpine" style={{height: 400, width: 600}}>
<AgGridReact
rowData={rowData}
columnDefs={columnDefs}>
</AgGridReact>
</div>
</ClientOnly>
);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
发现错误了。 缺少标签
root.tsx 中
Found the error. It was missing the
tag in the root.tsx