Skip to content

DanShai/useMermaid-hook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

useMermaid

A React hook for using Mermaid

usage

import React from 'react'
import { useMermaid } from './useMermaid'

const ExampleMermaid = () => {
  const graph = `
  graph TD;
      A-->B;
      A-->C;
      B-->D;
      C-->D;
  `
  const svg = useMermaid('exampleID', graph)

  if (!svg) return <div>Loading...</div>

  return <div dangerouslySetInnerHTML={{ __html: svg }} />
}

Screenshot

About

react hook for Mermaid

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published