frontend-collective / frontend-collective/react-sortable-tree

After running the example I got errors

Open
#736 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5k
Forks
914
PR merge metrics
No merged PRs in 30d

Description

After installing the library in next.js, placing the global css in /pages/_app.js, the error you got was this:
```
export * from './common';
^^^^^^

SyntaxError: Unexpected token export
```
My code used:
```
import React, { Component } from 'react';
import SortableTree from 'react-sortable-tree';
// import 'react-sortable-tree/style.css'; // This only needs to be imported once in your app

export default class Tree extends Component {
constructor(props) {
super(props);

this.state = {
treeData: [
{ title: 'Chicken', children: [{ title: 'Egg' }] },
{ title: 'Fish', children: [{ title: 'fingerline'}] }
],
};
}

render() {
return (


this.setState({ treeData })}
/>

);
}
}
```

Please help me solve this. I really want to use this library.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the reported installation in a Next.js app with the global stylesheet imported from /pages/_app.js, then investigate the SyntaxError at './common'. Done means the provided tree example builds and runs without the unexpected export error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, next.js, react
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.