davidantoon / frontegg-react

Frontegg-React is pre-built Component for faster and simpler integration with Frontegg services.

Home Page:https://docs.frontegg.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Frontegg React

alt text

Frontegg is a web platform where SaaS companies can set up their fully managed, scalable and brand aware - SaaS features and integrate them into their SaaS portals in up to 5 lines of code.

BREAKING CHANGES SINCE VERSION 3.0.0

The new @frontegg/react uses AdminPortal and LoginBox instead of multiple components.

Installation

Use the package manager npm to install frontegg React.JS library.

npm install @frontegg/react

Configuration

Wrap your application with Frontegg Provider:

import { FronteggProvider } from '@frontegg/react'

const contextOptions = {
  baseUrl: 'https://{HOST}.frontegg.com', // Your backend base URL (frontegg will direct the requests to it)
}

export const App = () => {
  return <FronteggProvider contextOptions={contextOptions}>
    {/*...*/}
  </FronteggProvider>
}

Usage

You can use React Hooks to access Frontegg store.

import { useAuthUser } from '@frontegg/react'

const HomePage = () => {
  const user = useAuthUser();

  return <div>
    Logged In user: {user.email}
  </div>
}

Opening the Admin Portal is available via the following code snippet.

import { AdminPortal } from '@frontegg/react'

const Toolbar = () => {

  return <nav>
    {/*... your application tabs ...*/}

    <button onClick={() => AdminPortal.show()}>
      Open Admin Portal
    </button>
  </nav>
}

About

Frontegg-React is pre-built Component for faster and simpler integration with Frontegg services.

https://docs.frontegg.com/

License:MIT License


Languages

Language:TypeScript 84.5%Language:SCSS 11.7%Language:JavaScript 2.9%Language:Makefile 0.7%Language:HTML 0.1%Language:Dockerfile 0.0%Language:Shell 0.0%