0.0.3 • Published 10 months ago

@sfdl/sf-cookie-gate v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Cookie Gate

This is a small React HoC library for gating top level components behind a cookie.

Installation

Install from npm using the package manager of your choice

yarn add @sfdl/sf-cookie-gate or npm install @sfdl/sf-cookie-gate

Usage

The application exposes a minimal API. Essentially it is a bi-directional HoC which pushes down one path or another depending on whether a cookie has been set. A cookie handler function is provided for convenience

PropDescriptionType
ApplicationComponentThe component to be shown if the cookie is setJSX Element or React.lazy Element
LandingComponentThe component to be shown if the cookie is not setJSX Element or React.lazy Element
optionsAn object of options to configure the cookieCookieOptions

CookieOptions

The cookie options object is used to structure and configure the cookie. It has the following key/values | Key | Value | |-----|-------| | cookieName | cookie name string | | cookieOptions | an object of js-cookie options|