⚛️ Use from any JavaScript framework
This package can be used from any JavaScript framework, or NodeJS.
For example, to use it in a nextjs react app:
-
Create the project and
cd
into your new app folder -
Add the
@biopragmatics/curies
dependency to your project: -
Add code, e.g. in
src/app/page.tsx
running on the client:src/app/page.tsx'use client' import { useEffect, useState } from 'react'; import init, { getBioregistryConverter } from "@biopragmatics/curies"; export default function Home() { const [output, setOutput] = useState(''); useEffect(() => { // Initialize the wasm library and use it init().then(async () => { const converter = await getBioregistryConverter(); const curie = converter.compress("http://purl.obolibrary.org/obo/DOID_1234"); const uri = converter.expand("doid:1234"); setOutput(`${curie}: ${uri}`); }); }, []); return ( <main> <p>{output}</p> </main> ); }
-
Start in dev: