Skip to content

Compile error in brand new clean react app. #2115

@bwilson

Description

@bwilson

I created a brand new react app with create-react-app, and then installed react-data-grid. I then added the import to App.js (import ReactDataGrid from 'react-data-grid';) and immediately got a compile error:

Failed to compile.

./node_modules/react-data-grid/lib/DataGrid.js 101:39
Module parse failed: Unexpected token (101:39)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| 
|   const headerRowsCount = enableFilters ? 2 : 1;
>   const summaryRowsCount = summaryRows?.length ?? 0;
|   const isSelectable = selectedRows !== undefined && onSelectedRowsChange !== undefined;
|   const {

What steps do I need to take to get this working?

Here is my package.json file:

    "name": "trash",
    "version": "0.1.0",
    "private": true,
    "dependencies": {
        "@testing-library/jest-dom": "^4.2.4",
        "@testing-library/react": "^9.5.0",
        "@testing-library/user-event": "^7.2.1",
        "react": "^16.13.1",
        "react-data-grid": "^7.0.0-canary.19",
        "react-dom": "^16.13.1",
        "react-scripts": "3.4.2"
    },
    "scripts": {
        "start": "react-scripts start",
        "build": "react-scripts build",
        "test": "react-scripts test",
        "eject": "react-scripts eject"
    },
    "eslintConfig": {
        "extends": "react-app"
    },
    "browserslist": {
        "production": [
            ">0.2%",
            "not dead",
            "not op_mini all"
        ],
        "development": [
            "last 1 chrome version",
            "last 1 firefox version",
            "last 1 safari version"
        ]
    }
}

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions