Socket
Book a DemoInstallSign in
Socket

@metomic/alias-react

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metomic/alias-react

Use metomic Alias with your react application

0.3.3
latest
Source
npmnpm
Version published
Weekly downloads
14
1300%
Maintainers
1
Weekly downloads
 
Created
Source

@metomic/alias-react

Use metomic alias with your react application

NPM

Install

yarn add @metomic/alias-react

Usage

Step 1. Configure an AliasProvider at the top level

// in your main / index / app root
import React from 'react'
import {AliasProvider} from '@metomic/alias-react'

ReactDOM.render(
  // your appId is given to you when you join the Alias alpha
  <AliasProvider appId={"YOUR-APP-ID"}> 
    <App />
  </AliasProvider>
, document.getElementById('root'))

2. Use the useAlias hook in your component

import {useAlias, AliasToggle} from '@metomic/alias-react

const MySignupBox = () => {
  // Provide a purpose for this alias
  const {ref, toggleSecured, isSecured, } = useAlias({ purpose: 'marketing' })

  return (
    <div>
      {/* To make alias work, the alias "ref" parameter has to be provided to the input element you wish to use */}
      <input ref={ref}>
      
      {/* Finally, set up a toggle to control whether or not the mail address is secured */}
      <AliasToggle onChange={toggleSecured} />
    </div>
  )


}

License

MIT © metomic

FAQs

Package last updated on 02 Jul 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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.