Skip to content

Exo5 Modif The three symptoms#6

Open
axelvuillaume wants to merge 6 commits intoselego:mainfrom
axelvuillaume:theThreeSymptoms
Open

Exo5 Modif The three symptoms#6
axelvuillaume wants to merge 6 commits intoselego:mainfrom
axelvuillaume:theThreeSymptoms

Conversation

@axelvuillaume
Copy link
Copy Markdown

No description provided.

Comment thread exercises/the-three-symptoms.js Outdated
Comment on lines +83 to +103
const debouncedSaveSearchState = debounce(() => {
if (saveSearchState) {
localStorage.setItem('lastSearchQuery', query);
localStorage.setItem('lastSearchFilters', JSON.stringify(filters));
}
}, 1000);


useEffect(() => {
debouncedSaveSearchState();
return () => debouncedSaveSearchState.cancel();
}, [query, filters]);

useEffect(() => {
return () => {
if (saveSearchState) {
localStorage.removeItem('lastSearchQuery');
localStorage.removeItem('lastSearchFilters');
}
};
}, [query, filters, saveSearchState]);
}, [saveSearchState]);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

éviter de laisser des localhost comme ça, autant faire tout en state ou à la rigueur enregistrer ça en base si c'est important.

Comment thread exercises/the-three-symptoms.js Outdated
Comment on lines 106 to 115
const handleFilterChange = (e) => {
const { name, value, type, checked } = e.target;
const newValue = type === 'checkbox' ? checked : value;

setFilters(prev => ({
...prev,
[name]: type === 'checkbox' ? checked : value
[name]: newValue,
}));
setPage(1); // Reset page when filters change
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

directement mettre les éléments dans les onChange et pas faire une fonction générique pour les filtres.

Comment thread exercises/the-three-symptoms.js Outdated
Comment on lines +67 to +72
const categorizedProducts = products.reduce((acc, product) => {
acc[product.category] = acc[product.category] || [];
acc[product.category].push(product);
return acc;
}, {});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

on privilégie ça côté back la plus part du temps

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