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
marketsandfavoritesarrays.useNeutralMarketsis a custom hook that filters out markets listed infavoritesfrom the total list of markets retrieved viauseMarkets.Markets: Always displayed, listing all markets or showing an empty state if no markets are available.
Uses
MarketRowcomponents to render individual market entries in both sections.
Hooks
useState(favorites): Initializes and manages an array of favorite markets based on thefavoriteMarketsprop.useNeutralMarkets: Fetches an array of all neutral market entries, markets not market as favorite.
Last updated