React - Samples Overview

This page lists common, production-grade React UI samples included in this tutorial set. Each sample has a runnable demo and source code.

Try it

View source
function SampleCard({ title, desc, href }){
  return (
    <a href={href} style={{textDecoration:'none', color:'inherit'}}>
      <article style={{border:'1px solid var(--border)',borderRadius:10,padding:12,background:'var(--panel)'}}>
        <h3 style={{margin:'0 0 6px 0',color:'var(--accent-2)',fontSize:16}}>{title}</h3>
        <p style={{margin:0,color:'var(--muted)',fontSize:14}}>{desc}</p>
      </article>
    </a>
  );
}
function App(){
  const demo = [
    { title:'Login & Signup Form', desc:'Auth forms with validation and async flows.', href:'react-login-signup-form.php' },
    { title:'Data Table Sorting & Filtering', desc:'Sortable headers and client-side filtering.', href:'react-data-table-sorting-filtering.php' },
  ];
  return (
    <div style={{display:'grid',gridTemplateColumns:'repeat(auto-fill,minmax(220px,1fr))',gap:12}}>
      {demo.map(item => <SampleCard key={item.title} {...item} />)}
    </div>
  );
}
ReactDOM.createRoot(document.getElementById('try-samples-overview')).render(<App />);

Syntax primer (for newcomers)

  • Render lists with array.map() and give each element a stable key.
  • JSX attributes like href and inline styles are passed as props.

Common pitfalls

  • Avoid using array indexes as keys when items can be re-ordered.
  • Use semantic elements: links (<a>) for navigation, buttons for actions.

Checks for Understanding

  1. Why use stable keys when rendering lists of links/cards?
  2. When should a link (<a>) be used over a button?
Show answers
  1. Stable keys help React reconcile items correctly across updates.
  2. Use a link for navigation to another page/screen; use a button for in-place actions.

Exercises

  1. Add two more sample cards and ensure keys are unique and stable.
  2. Show a short tag (e.g., “auth”, “data”) on each card; filter the grid by tag.
  3. Make the grid responsive with different column counts at narrower widths.