Submitted 4 months agoA solution to the Product list with cart challenge
React Router + tailwind
react, tailwind-css
P
@niuguy

Solution retrospective
What are you most proud of, and what would you do differently next time?
- Solved the image import problem using
const importAll = (r: Record<string, { default: string }>) => {
const imageMap: Record<string, string> = {};
Object.entries(r).forEach(([key, value]) => {
imageMap[key.replace('../assets/images/', '')] = value.default;
});
return imageMap;
};
const imageImports = importAll(import.meta.glob('../assets/images/*.jpg', { eager: true }));
- Refactored the codebase using context to handle shopping cart state
Code
Loading...
Please log in to post a comment
Log in with GitHubCommunity feedback
No feedback yet. Be the first to give feedback on Feng's solution.
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord