Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

rpirvate router react

import React from 'react'
import { Route, Redirect, RouteComponentProps } from 'react-router-dom'
import { getAuth } from './utils/storage'

export const PrivateRoute = ({ component: Comp, ...rest }) => (
	<Route {...rest} render={(props: RouteComponentProps<any>) => (!getAuth() ? <Redirect to='/' /> : <Comp {...props} />)} />
)
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to choose a weighted random array element in javascript 
Javascript :: js if animation infinity end 
Javascript :: Self Invoking Function ($()) That Can Be Reused 
Javascript :: usestate access previous state 
Javascript :: postgresql nodejs 
Javascript :: change firebase email on login 
Javascript :: iterating map javascript 
Javascript :: js foreach syntax 
Javascript :: js index of 
Javascript :: export default function react 
Javascript :: what is slot in vue.js 
Javascript :: extract data from pdf nodejs 
Javascript :: find an object in an array by one of its properties 
Javascript :: js unshift vs push 
Javascript :: material-ui add icon to switch when on 
Javascript :: for loop in js 
Javascript :: jquery datatable 
Javascript :: js date minus 18 years 
Javascript :: object.assign in node.js 
Javascript :: react native generate signed apk getting older version 
Javascript :: splice state react 
Javascript :: assign values to array in javascript 
Javascript :: javascript wait for async function to finish 
Javascript :: how to add animation over image in Javascript 
Javascript :: remove element from object javascript 
Javascript :: call node.js file electron 
Javascript :: i get two times event click of button javascript 
Javascript :: javascript filter 2d array 
Javascript :: mouse wheel scroll sections in react 
Javascript :: creating a custom function to use nodemailer to send email 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =