I'm trying to use the client-ready version of the component. However I'm facing the following error:
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
I have attached a bare-bones version of what I'm trying to achieve.
sample.zip
@KamyarP This is not an issue related to react-bootstrap-table2, you'll need babel and other packages to make your index.html file render React components. Thanks.
@prajapati-parth I don't think any compilation is required since all js files are compiled version and UMD ready.
The React script references are umd version so there's no need for a Babel compiler.
Also, I have compiled my SampleApp.jsx with Babel 6.7.7 and included the compiled version SampleApp.js in my index.html So my component has already been compiled.
I have used React.createElement to render my component in index.html so it also does not need any compilation: ReactDOM.render(React.createElement(SampleApp, null, null), document.getElementById("reactContainer"));
I have already successfully rendered other components using this approach.
To test it, just add return React.createElement('div', null, 'Hello'); in render method in sampleApp.js (line 36) and the component is redered and displayed in page.
@KamyarP Okay. I see I missed that. I'll check it out.
I'll also check this if I got time.
@KamyarP try again for https://unpkg.com/[email protected]/lib/index.js instead of the bundled file from dist
Maybe I do something wrong for the those UMD bundled in dist, I'll also double check
@KamyarP try:
const BootstrapTable = ReactBootstrapTable.default;
render() {
return<BootstrapTable .../>;
}
and let me know if the problem is still remain and open this issue again, thanks
I will improve the UMD system in future
Most helpful comment
@KamyarP try:
and let me know if the problem is still remain and open this issue again, thanks
I will improve the UMD system in future