Hooks and routing - #5
Open
Dilafruz-17 wants to merge 2 commits into
Open
Conversation
✅ Deploy Preview for bejewelled-narwhal-df5d36 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ Deploy Preview for beautiful-kataifi-5ce227 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
aleksey-drozdov
suggested changes
May 30, 2026
| @@ -0,0 +1,36 @@ | |||
| import { ApiResponse, PokemonDetail } from '../types'; | |||
There was a problem hiding this comment.
use import aliases like
import { ApiResponse, PokemonDetail } from '@/types';
| @@ -0,0 +1,36 @@ | |||
| import { ApiResponse, PokemonDetail } from '../types'; | |||
|
|
|||
| const BASE_URL = 'https://pokeapi.co/api/v2'; | |||
Comment on lines
+34
to
+35
| const data: PokemonDetail = await response.json(); | ||
| return data; |
| const description = `Type: ${types} | Height: ${pokemon.height} | Weight: ${pokemon.weight} | Base EXP: ${pokemon.base_experience}`; | ||
|
|
||
| return ( | ||
| <div className="card" onClick={() => onClick(pokemon.name)} style={{ cursor: 'pointer' }}> |
|
|
||
| function Card({ pokemon, onClick }: CardProps) { | ||
| const types = pokemon.types.map((t) => t.type.name).join(', '); | ||
| const description = `Type: ${types} | Height: ${pokemon.height} | Weight: ${pokemon.weight} | Base EXP: ${pokemon.base_experience}`; |
There was a problem hiding this comment.
why are you adding types here if you use them separately in the code below?
Comment on lines
+18
to
+21
| const trimmed = inputValue.trim(); | ||
| setValue(trimmed); | ||
| setInputValue(trimmed); | ||
| onSearch(trimmed); |
There was a problem hiding this comment.
just onSearch(inputValue.trim())
| const STORAGE_KEY = 'pokemon-search-term'; | ||
|
|
||
| export function useLocalStorage() { | ||
| const getValue = (): string => { |
| fetchPokemonDetail(name) | ||
| .then((data) => { | ||
| setPokemon(data); | ||
| setLoading(false); |
There was a problem hiding this comment.
use finally for setLoading(false)
| )} | ||
| </section> | ||
|
|
||
| {!loading && pokemons.length > 0 && ( |
There was a problem hiding this comment.
move pagination to separate component
| }; | ||
| } | ||
|
|
||
| export interface ApiResponse { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Task: https://github.com/rolling-scopes-school/tasks/blob/master/tasks/react/modules/module02/hooks-and-routing.md
Screenshot:
Deployment: https://beautiful-kataifi-5ce227.netlify.app/
Done 16.05.2026 / 2026-05-19 02:59
Score: 100 / 100