Skip to content

Instantly share code, notes, and snippets.

View KRRISH96's full-sized avatar
🎯
Focusing

Sai Krishna Prasad Kandula KRRISH96

🎯
Focusing
View GitHub Profile
@KRRISH96
KRRISH96 / App.css
Created April 15, 2021 11:41
React Layout Switch Blog Example CSS files
.users-table-container {
overflow-x: auto;
box-shadow: var(--shadow);
border-radius: 0.2rem;
}
.users-table-container .users-table {
border-spacing: 0;
text-transform: capitalize;
min-width: 35rem;
@KRRISH96
KRRISH96 / useFetch.js
Created April 5, 2021 07:53
Simple useFetch react custom hook
import { useState, useEffect } from 'react';
const API_BASE_URL = 'https://jsonplaceholder.typicode.com'; // Ex: API link, replace with required API URL
/**
* @param endpoint endpoint to fetch data from
* @returns { data, error, loading }
*/
export function useFetch(endpoint){
const [data, setData] = useState(null);
@KRRISH96
KRRISH96 / RenderSmoothImage.jsx
Last active January 22, 2023 16:52
A React component to render images smoothly.
// RenderSmoothImage.jsx
import React from "react";
import './styles.scss';
export default ({ src, alt = "notFound", objectFit = "contain" }) => {
const [imageLoaded, setImageLoaded] = React.useState(false);
const [isValidSrc, setIsValidSrc] = React.useState(!!src);
return (