Markets
The Markets
component displays a list of market entities, differentiated into "Favorite Markets" and a general "Markets" category. It provides a UI for user interaction with market entries.
Props
markets
(Market[]
): Array of market objects representing all available markets.favoriteMarkets
(Market[]
): Array of market objects that the user has marked as favorites.
Behavior
Displays two sections if conditions are met:
Favorite Markets: Shown if there are entries in both
markets
andfavorites
arrays.useNeutralMarkets
is a custom hook that filters out markets listed infavorites
from the total list of markets retrieved viauseMarkets
.Markets: Always displayed, listing all markets or showing an empty state if no markets are available.
Uses
MarketRow
components to render individual market entries in both sections.
Hooks
useState
(favorites
): Initializes and manages an array of favorite markets based on thefavoriteMarkets
prop.useNeutralMarkets
: Fetches an array of all neutral market entries, markets not market as favorite.
Last updated