@learncard/react 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # @learncard/react
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@learncard/react)](https://www.npmjs.com/package/@learncard/react)
4
+ [![npm downloads](https://img.shields.io/npm/dw/@learncard/react)](https://www.npmjs.com/package/@learncard/react)
5
+ [![vulnerabilities](https://img.shields.io/snyk/vulnerabilities/npm/@learncard/react)](https://www.npmjs.com/package/@learncard/react)
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pnpm install @learncard/react
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```js
16
+ import React, { useState, useEffect } from "react";
17
+ import { walletFromKey } from "@learncard/core";
18
+ import { VCCard } from "@learncard/react";
19
+ import { VC } from "@learncard/types";
20
+
21
+ const Test = () => {
22
+ const [vc, setVc] = useState<VC | null>(null);
23
+
24
+ useEffect(() => {
25
+ const getVc = async () => {
26
+ const wallet = await walletFromKey(''); // Bad practice! You should be generating keys...
27
+ const uvc = wallet.getTestVc();
28
+ setVc(await wallet.issueCredential(uvc));
29
+ };
30
+
31
+ getVc();
32
+ }, []);
33
+
34
+ if (!vc) return <>Generating Credential...</>; // Loading placeholder while credential is generated
35
+
36
+ return <VCCard credential={vc} />; // Show card for the generated credential with validation results
37
+ };
38
+ ```
39
+
40
+ ## Docs
41
+
42
+ Read the official docs [here](https://app.gitbook.com/o/6uDv1QDlxaaZC7i8EaGb/s/LRHp8IUs5bJdshkB3Sbs/)!
43
+
44
+ ## License
45
+
46
+ MIT © [Taylor Beeston <beeston.taylor@gmail.com>](https://github.com/TaylorBeeston)