hardMachine Coding

Build an E-commerce Product Filter grid

1.2k views
01

Understand the problem

Build a product grid with category, price and rating filters plus sort.

ReactFiltersData
02

Attempt it yourself

Sketch your approach before reading the solution — that's what interviews test.

Stuck? AI Nudge Available

Get a conceptual hint to guide your logic without spoiling the final implementation.

03

Study the solution

Solve in

The solution is waiting

Give it an honest attempt first — then compare your thinking with the full walkthrough.

04

React solution

Complete solutionRun Playground
import React from 'react';
import ProductFilter from './src/ProductFilter';

const products = [
  { id: 1, name: 'Headphones', category: 'Audio', price: 120 },
  { id: 2, name: 'Speaker', category: 'Audio', price: 80 },
  { id: 3, name: 'Keyboard', category: 'Computers', price: 60 },
  { id: 4, name: 'Mouse', category: 'Computers', price: 30 },
  { id: 5, name: 'Monitor', category: 'Computers', price: 220 },
  { id: 6, name: 'Camera', category: 'Photo', price: 450 },
  { id: 7, name: 'Tripod', category: 'Photo', price: 40 },
  { id: 8, name: 'Earbuds', category: 'Audio', price: 95 },
];

export default function App() {
  return (
    <div style={{ fontFamily: 'sans-serif', padding: 20 }}>
      <h1>Product Filter Demo</h1>
      <ProductFilter products={products} />
    </div>
  );
}
05

Join the discussion

Discussion (0)

Sign in to join the discussion.

No responses yet. Be the first to share what you think.