simPod / react-graphql-syntax-highlighter

A React component for GraphQL syntax highlighting

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GraphQL syntax highlighting React component

Installation

yarn add react-graphql-syntax-highlighter

Example usage

import { GraphQLCodeBlock } from 'react-graphql-syntax-highlighter';
import 'react-graphql-syntax-highlighter/dist/style.css';
import React from 'react';

interface Props {
  code: string;
}

export const GraphqlCodeBlock: React.FC<Props> = ({ code }) => (
  <GraphQLCodeBlock src={code} />
);

The components only takes two props: className and code. code is a graphql query string.

About

A React component for GraphQL syntax highlighting


Languages

Language:TypeScript 74.1%Language:CSS 25.9%