Overview
PeliculaGrid is a container component that renders a responsive grid of PeliculaCard components. It handles loading states and empty results scenarios.
Import
Props
Array of movie objects to display in the grid. Each movie object should contain all properties required by
PeliculaCard.Indicates whether movies are currently being loaded/filtered. When
true, displays a loading spinner instead of the grid.Component Signature
Conditional Rendering
Loading State
Whenloading is true, renders the LoadingSpinner component:
Empty State
When thepeliculas array is empty or null, displays an empty state message:
Grid State
When movies are available, renders them in a grid layout:Usage Example
- With Hook
- With Static Data
Behavior Flow
CSS Classes
.pelicula-grid- Main grid container.pelicula-grid__empty- Empty state container.pelicula-grid__empty-text- Empty state message text
Dependencies
react- Core React libraryPeliculaCard- Individual movie card componentLoadingSpinner- Loading indicator component
Performance Considerations
- Uses
pelicula.idas the React key for optimal reconciliation - No internal state management - purely presentational
- Efficient re-rendering based on prop changes only
Source Location
src/components/PeliculaGrid.jsx:5