dev #1
No reviewers
Labels
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: veerjot_dml/assignment4_api#1
Loading…
Reference in a new issue
No description provided.
Delete branch "dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@ -0,0 +6,4 @@
import BreedInfoPage from "./components/BreedInfoPage";
import "./App.css";
import { debounce } from "lodash";
const apikey ="live_8bnMZatSzkOR7eyT6o0iwDmXQuTxPI3deVWy0KY2ABxDkTMJdTYZ13S9lVFmrZRO"
better use more secure way to store the keys create one env file to store these keys and access them from there
@ -0,0 +2,4 @@
import { useParams, useNavigate } from "react-router-dom";
const API_URL = "https://api.thecatapi.com/v1";
const API_KEY = "live_8bnMZatSzkOR7eyT6o0iwDmXQuTxPI3deVWy0KY2ABxDkTMJdTYZ13S9lVFmrZRO";
same here as well
@ -0,0 +6,4 @@
<h2 className="fav-heading">Favorites Gallery</h2>
<div className="favorites">
{favorites.map((cat) => (
<div key={cat.id} className="cat-item">
use optional chaining here use cat?.id instead of cat.id
@ -0,0 +8,4 @@
type="text"
name="breed"
placeholder="Search by breed name"
value={filters.breed}
use optional chaining here as well
@ -0,0 +15,4 @@
<select
name="hairLength"
value={filters.hairLength}
use optional chaining here
@ -0,0 +14,4 @@
const handleCatClick =(cat)=>{
console.log('id',cat)
if (cat.breeds && cat.breeds[0] && cat.breeds[0].id) {
navigate(`/breed/${cat.breeds[0].id}`);
whenever use navigation start using optional chaining that will reduce the chance of breakage