I am doing the exercises in John Larsen's book React Hooks in Action, chapter 2. When I clone his repository, the react app starts successfully. However, when I write it myself (and check again that I did not overlook any piece of code), I get an error.
Here's my minimal code to reproduce the problem :
My project's structure is
public
index.html
src
components
App.js
index.js
static.json
package.json
The content of static.json
is copied from his git repo.
Here's the content of App.js
import {bookables} from "../static.json";
export default function App() {
const bookablesInGroup = bookables.filter(b => b.group === "Room");
return ( <p>Hello</p> )
}
And I get the following error
ERROR in ./src/components/App.js 7:27-43
export 'bookables'.'filter' (imported as 'bookables') was not found in '../static.json' (possible exports: 0, 1, 2, 3, 4, 5)
My first idea was to add an export in static.json
, but it's clearly not the solution. It's driving me crazy. What did I overlook ? Thanks!