Skip to content

Instantly share code, notes, and snippets.

View sahilrajput03's full-sized avatar
💭
Eating, Sleeping, Coding, Repeat.

Sahil Rajput sahilrajput03

💭
Eating, Sleeping, Coding, Repeat.
View GitHub Profile
@sahilrajput03
sahilrajput03 / README.md
Created September 18, 2020 16:43 — forked from iansu/README.md
Create React App 4.0 Alpha Testing

Create New App

JavaScript Template

npx create-react-app@next --scripts-version=@next --template=cra-template@next my-js-app

TypeScript Template

npx create-react-app@next --scripts-version=@next --template=typescript@next my-ts-app

@sahilrajput03
sahilrajput03 / Rest api's.md
Last active August 20, 2023 19:26
A good list of rest api's.
@sahilrajput03
sahilrajput03 / random number(async).js
Last active September 22, 2020 14:36
Generating random number while waiting.
const randomNumber = () =>
new Promise((res, rej) =>
setTimeout(() => {
res("happy birthday");
}, 2000)
);
console.log("Cool", await randomNumber());
@sahilrajput03
sahilrajput03 / useFetch.js
Last active October 1, 2020 11:27
This is a react hook for fetching data.
// Usage -
//import {useFetch} from "./useFetch.js";
//const url = "https://raw.githubusercontent.com/ajzbc/kanye.rest/quotes/quotes.json";
//const {data, loading} = useFetch(url);
// --
//Defining hook inside useFetch.js file.
import { useEffect, useState, useRef } from "react";
export const useFetch = (url) => {
const isMounted = useRef(true);
@sahilrajput03
sahilrajput03 / json stringify.js
Created September 23, 2020 05:34
This is a JsonStringify react component.
const JsonStringify = ({data}) => <pre>{JSON.stringify(data, null, 2)}</pre>;
@sahilrajput03
sahilrajput03 / useField.js
Last active October 29, 2020 17:32
React hook for inpts. #react #hooks
//import {useField} from "../hooks/useField";
//const name = useField("text", "Enter name here");
//const age = useField("text", "Enter age here");
//const date = useField("date", "Enter date here");
//--
//<input {...name} />
//<input {...age} placeholder="Set more props here." />
//<input {...date} />
import {useState} from "react";
@sahilrajput03
sahilrajput03 / live debug.js
Last active September 26, 2020 14:51
Tags: #live debug, #live-debug, #jsx debug, #jsx debug, #debugging
<div><pre><b>|--Live-Debug--|</b>{JSON.stringify(values, null, 2)}</pre></div>
@sahilrajput03
sahilrajput03 / Search my gists.md
Created September 26, 2020 16:43 — forked from santisbon/Search my gists.md
How to search gists

Enter this in the search box along with your search terms:

Get all gists from the user santisbon.
user:santisbon

Find all gists with a .yml extension.
extension:yml

Find all gists with HTML files.
language:html

@sahilrajput03
sahilrajput03 / Articles | repos to read.md
Last active October 22, 2020 15:03
Articles list to read #bucketlist #articles #article #markAsReadAndKeepSourcesForLife