I'm attempting to use the react-table package from the https://react-table.js.org/#/story/readme inside of my Shopify App, however, I can't get the actual table to render. Only the text part of the table shows up? Anybody have any clue on what would be causing this? Could it be having issues since it is inside of an iFrame? See image below.
Problem found:
Added <link rel="stylesheet" href="https://unpkg.com/react-table@latest/react-table.css"> directly on my view page and it worked. the import css was not importing correctly.
import React from 'react'
import ReactDOM from 'react-dom'
import ReactTable from 'react-table'
import PropTypes from 'prop-types'
import { Page, Card, Select, Button, TextField, Stack, FormLayout,
Thumbnail, ResourceList, Pagination, Layout, Checkbox } from '@shopify/polaris';
import "react-table/react-table.css"
class PriceTestContainer extends React.Component {
render() {
const data = [{
age: 26,
visits: 100
},{
age: 44,
visits: 200
}]
return (<ReactTable
data={data}
columns={[
{
Header: "Info",
columns: [
{
Header: "Age",
accessor: "age"
}
]
},
{
Header: 'Stats',
columns: [
{
Header: "Visits",
accessor: "visits"
}
]
}
]}
defaultPageSize={10}
className="-striped -highlight"
/>
);
}
}
document.addEventListener('DOMContentLoaded', () => {
const node = document.getElementById('zzz')
ReactDOM.render(<PriceTestContainer />, node)
})
