Skip to content

Instantly share code, notes, and snippets.

View ashug0001's full-sized avatar

Ashutosh Gupta ashug0001

  • New Delhi, India
View GitHub Profile
@ashug0001
ashug0001 / doc.md
Last active May 10, 2023 05:13
create_patch

Make changes to the files you want to apply depending on scenario.

  1. Once changes are done, add them to stash buy running below 👇 command:
git stash
  1. Once stash is done, create a patch file for the diff
git stash show -p stash@{0} > {file_name}
@ashug0001
ashug0001 / ProtectedRoute.js
Created December 16, 2020 16:11
Protected Route for React for Redux
import React from "react";
import { Route, Redirect } from "react-router-dom";
import { connect } from "react-redux";
import PropType from "prop-types";
const ProtectedRoutes = ({ isLoggedIn, children, ...rest }) => {
return isLoggedIn ? (
<Route {...rest} render={(props) => children} />
) : (
<Redirect to="/login" />