Architecture
Nadie Sabe Nada uses Redux Toolkit for centralized state management. Redux Toolkit provides a simplified and opinionated approach to Redux development with built-in best practices.Store Configuration
The application store is configured insrc/store/store.js using Redux Toolkit’s configureStore:
src/store/store.js
State Structure
The Redux store is organized into four main slices:Podcast Slice
Manages podcast episodes, favorites, and user collections
Player Slice
Controls audio playback state and current podcast
Audio Time Slice
Tracks playback positions for each episode (Redux)
Audio Time Context
React Context for playback time management and persistence
Filter Slice
Manages episode filtering and pagination
Using Redux in Components
Components access Redux state using theuseSelector hook and dispatch actions using the useDispatch hook:
Key Features
Async Thunks
Async Thunks
Redux Toolkit’s
createAsyncThunk handles asynchronous operations like API calls with built-in pending/fulfilled/rejected states.Immer Integration
Immer Integration
Redux Toolkit uses Immer internally, allowing you to write “mutating” logic in reducers that is actually immutable.
LocalStorage Persistence
LocalStorage Persistence
User preferences and playback data are automatically persisted to localStorage for offline access.
TypeScript Ready
TypeScript Ready
While this app uses JavaScript, Redux Toolkit is designed with TypeScript in mind and provides excellent type inference.
State Persistence
Several state slices persist data to localStorage:- Podcast episodes: Favorites, completed, listen later lists
- Playback times: Current position in each episode
- Player volume: User’s preferred volume level
- Playback preferences: Whether to save playback times
Next Steps
Explore each slice in detail:- Podcast Slice - Episode data and collections
- Player Slice - Playback controls
- Audio Time Slice - Playback position tracking
- Filter Slice - List filtering and pagination
