You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

amplify-react-router

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amplify-react-router

AWS Amplify's Auth wrapped with reach router

2.0.0-alpha.2
latest
Source
npm
Version published
Weekly downloads
14
55.56%
Maintainers
1
Weekly downloads
 
Created
Source

amplify-react-router

Router Wrapper around the Authenticator from aws-amplify-react

NPM License Code Style CircleCI

Having to rely on local authState is a pain the butt when you want to use a router as well as overriding the default components. This component makes that even easier now.

Installation

yarn add amplify-react-router aws-amplify-react aws-amplify react-router-dom

Usage

import React from 'react';
import AmplifyRouter from 'amplify-react-router';
import { Router, navigate } from '@reach/router';
import MySignIn from './SignIn';
import Page from './Page';
import awsExports from './aws-exports';

export default () => (
    <AmplifyRouter
        amplifyConfig={awsExports}
        homeRoute="/home"
        navigate={navigate}
        componentOverrides={[MySignIn]}
    >
    <Router>
        <Page path="/home" />
    </Router>
</AmplifyRouter>
);

You no longer have to pass in the hide property for components you want to override. Only pass in the components to the hide prop that you want to actually hide.

All overriden components should be placed in the componentOverrides and will auto hide their super class s component.

Props

All the base Authenticator Props plus the below.

Prop NameTypesDefaultDescription
componentOverridesArray(Component)OptionalThe auth components you want to override
homeRouteString/The home route to navigate to when once signed in
navigate(route: string) => voidFunction that takes new route to optionally push to history api for router.

Keywords

react

FAQs

Package last updated on 18 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts