Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

446 B
Raw Blame
// Fixture: a browser component importing a package that spawns git.
import { memo, useEffect, useState } from 'react';
// alint-expect
import { simpleGit } from 'simple-git';

export const BranchBadge = memo<{ cwd: string }>(({ cwd }) => {
  const [branch, setBranch] = useState('');
  useEffect(() => {
    simpleGit(cwd)
      .branchLocal()
      .then((result) => setBranch(result.current));
  }, [cwd]);
  return <span>{branch}</span>;
});