Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"react-pivot/index.jsx" Unexpected token error when using "basic example" from documentation #65

Open
nissan opened this issue May 5, 2018 · 3 comments

Comments

@nissan
Copy link

nissan commented May 5, 2018

Using the exact syntax of Basic example I get the error when trying to embed this as a React component in a page:

../node_modules/react-pivot/index.jsx
Module parse failed: Unexpected token (120:6)
You may need an appropriate loader to handle this file type.
| 
|     var html = (
|       <div className='reactPivot'>
| 
|       { this.props.hideDimensionFilter ? '' :

My call is simply

import React from "react";
import { BrowserRouter as Router, Route, Link } from "react-router-dom";
import AddressBookPivotTable from '../components/AddressBookPivotTable';

const Routes = ({ props }) => (
  <Router>
    <AddressBookPivotTable/>
  </Router>
);

export default Routes;

and the underlying component is declared as

class AddressBookPivotTable extends React.Component {
  render() {
    return (
      <ReactPivot
        rows={rows}
        dimensions={dimensions}
        reduce={reduce}
        calculations={calculations}
        activeDimensions={["Transaction Type"]}
        nPaginateRows={25}
      />
    );
  }
}
export default AddressBookPivotTable;

It's a create-react-app generated application this is embedded within.
Any help solving this would be appreciated

@davidguttman
Copy link
Owner

Does this help? #12 (comment)

@kelyndm
Copy link

kelyndm commented Jul 26, 2018

Check out #47 towards the bottom. Currently this does not work with create-react-app.

@dwy189
Copy link

dwy189 commented Jul 3, 2019

Can it work with create-react-app now? Please update. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants