Skip to content

Latest commit

 

History

History
 
 

react

React JS Glue library

Embed mCaptcha widget in webpages built using React Js

NPM JavaScript Style Guide 0.1.0 Build) codecov

Install

npm install --save @mcaptcha/react-glue

Usage

For React based projects:

import React, { Component, WidgetConfig } from 'react'

import MCaptchaWidget from 'react-glue'
import 'react-glue/dist/index.css'

class Example extends Component {
  render() {
    const siteKey: SiteKey = {
      key: 'randomSiteKeyAsDisplayedInAdminPanel'
    }
    const config: WidgetConfig = { siteKey }

    return <MCaptchaWidget {...config} />
  }
}

For Next.JS based projects:

import React from 'react';
import { MCaptchaWidget } from '@mcaptcha/react-glue';

function Captcha() {
    const config = {
        widgetLink: new URL('https://yourdomain.tld/widget/?sitekey=yourstiekey')
    };

    return (
        <MCaptchaWidget {...config} />
    );
}

export default Captcha;