Skip to content

Hooks and routing - #5

Open
Dilafruz-17 wants to merge 2 commits into
mainfrom
hooks-and-routing
Open

Hooks and routing#5
Dilafruz-17 wants to merge 2 commits into
mainfrom
hooks-and-routing

Conversation

@Dilafruz-17

Copy link
Copy Markdown
Owner
  1. Task: https://github.com/rolling-scopes-school/tasks/blob/master/tasks/react/modules/module02/hooks-and-routing.md

  2. Screenshot: image

  3. Deployment: https://beautiful-kataifi-5ce227.netlify.app/

  4. Done 16.05.2026 / 2026-05-19 02:59

  5. Score: 100 / 100

  • Feature 1: Pagination ✅ (30/30)
  • Feature 2: Master-Detail View ✅ (45/45)
  • Feature 3: About Page ✅ (15/15)
  • Feature 4: 404 Page ✅ (10/10)

@netlify

netlify Bot commented May 15, 2026

Copy link
Copy Markdown

Deploy Preview for bejewelled-narwhal-df5d36 ready!

Name Link
🔨 Latest commit 728457a
🔍 Latest deploy log https://app.netlify.com/projects/bejewelled-narwhal-df5d36/deploys/6a078d4889eeb300084630ff
😎 Deploy Preview https://deploy-preview-5--bejewelled-narwhal-df5d36.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@vercel

vercel Bot commented May 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
class-components Ready Ready Preview, Comment May 15, 2026 9:16pm

@netlify

netlify Bot commented May 15, 2026

Copy link
Copy Markdown

Deploy Preview for beautiful-kataifi-5ce227 ready!

Name Link
🔨 Latest commit 728457a
🔍 Latest deploy log https://app.netlify.com/projects/beautiful-kataifi-5ce227/deploys/6a078d489fe59200086610d2
😎 Deploy Preview https://deploy-preview-5--beautiful-kataifi-5ce227.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment thread src/api/pokemonApi.ts
@@ -0,0 +1,36 @@
import { ApiResponse, PokemonDetail } from '../types';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use import aliases like
import { ApiResponse, PokemonDetail } from '@/types';

Comment thread src/api/pokemonApi.ts
@@ -0,0 +1,36 @@
import { ApiResponse, PokemonDetail } from '../types';

const BASE_URL = 'https://pokeapi.co/api/v2';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move url to env file

Comment thread src/api/pokemonApi.ts
Comment on lines +34 to +35
const data: PokemonDetail = await response.json();
return data;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return await response.json()

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' }}>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use inline styles


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}`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just onSearch(inputValue.trim())

const STORAGE_KEY = 'pokemon-search-term';

export function useLocalStorage() {
const getValue = (): string => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about the other fields?

Comment thread src/pages/DetailPage.tsx
fetchPokemonDetail(name)
.then((data) => {
setPokemon(data);
setLoading(false);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use finally for setLoading(false)

Comment thread src/pages/MainPage.tsx
)}
</section>

{!loading && pokemons.length > 0 && (

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move pagination to separate component

Comment thread src/types/index.ts
};
}

export interface ApiResponse {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use a generic for type reuse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants