npm.io
0.4.0 • Published 5 years ago

credify-web-react

Licence
Version
0.4.0
Deps
1
Size
59 kB
Vulns
0
Weekly
0

credify-web-react

This is a React package of Credify Web SDK.

How to use

$ npm install credify-web
$ npm install credify-web-react

First, you need to call defineCustomElements() in your application.

/// index.ts or index.js
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';

// Additional lines
import { applyPolyfills, defineCustomElements } from 'credify-web/loader';

ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();

// Additional lines
applyPolyfills().then(() => {
  defineCustomElements();
});

Then, you can import React components like following.

import { CredifyModal } from 'credify-web-react';

const sample = () => {
  return (
    <div>
      <CredifyModal></CredifyModal>
      ...
    </div>
  )
}

Note

When you distribute this SDK, you will need to remove the first line in components.d.ts.