Nfc React Web
React component for the web nfc api.
Installation
yarn add nfc-react-web # or npm install nfc-react-web
Quickstart
To read a tag:
import Nfc from 'nfc-react-web'; const App = <Nfc = = // , />;
Note: The component will only read a tag successfully once, no matter if it isn't timed out.
To write to a tag:
import Nfc from 'nfc-react-web'; const App = <Nfc ="Written with nfc-react-web" = = // , />;
Note: Even when an error happens, the write process will still try to write to a tag.
Caveat
The web nfc api is still experimental. To enable it on Chrome in your android device, open a new tab and navigate to chrome://flags
, search form WebNFC
and enable it.