In this project, you'll build a frontend-only React app that showcases art galleries using data from the Harvard Art Museum API. Users will be able to navigate through galleries and view individual art pieces using React Router. This is great practice for learning routing, data rendering, and basic React architecture.
This setup phase ensures you have all necessary tools and files before you build the app. Here's a simplified whiteboard plan:
App.jsxdata folder and import harvardArt.js seed dataFollow these detailed steps to set up your environment:
npx tiged appacademy/aa-react18-vite-template art-museum
cd art-museum
npm install react-router-dom
Edit src/App.jsx to render:
function App() {
return <h1>Hello from App</h1>;
}
Then run:
npm run dev
Visit http://localhost:5173. You should see "Hello from App".
App.jsxReplace the contents with:
import { createBrowserRouter, RouterProvider } from 'react-router-dom';
const router = createBrowserRouter([
{
path: '*',
element: <h2>Page Not Found</h2>
}
]);
function App() {
return <RouterProvider router={router} />;
}
export default App;
Inside src, create a folder called data and inside it, create a file called harvardArt.js.
Run this command from the root of your project:
curl https://appacademy-open-assets.s3-us-west-1.amazonaws.com/Modular-Curriculum/content/react-redux/topics/intro-to-react/projects/art-museum/harvardArt.js > src/data/harvardArt.js
Then import the object in App.jsx:
import harvardArt from './data/harvardArt';
console.log(harvardArt);
Check your browser console at http://localhost:5173 to confirm the structure. You’ll use the records and objects fields throughout the project.
You now have a functioning React app with React Router and seed data. This solid foundation will support all future development for the Art Museum Project.
This kind of setup is often used in real-world scenarios where APIs provide data and frontend frameworks handle all the rendering. Think of it like building the museum's digital tour interface, where visitors can explore galleries without ever leaving the page—React swaps out the exhibits behind the scenes.