JBrowse 2 · React App examples

Import a config.json

Bundled at build time.

URIs in a config.json are relative to where it was served, so addRelativeUris resolves them against that URL. The file’s shape is JBrowseRootConfig.

View source — 13 lines
import { addRelativeUris } from '@jbrowse/core/util/addRelativeUris'
import { JBrowseApp, useCreateViewState } from '@jbrowse/react-app2'

import config from '../volvox-config.json' with { type: 'json' }

const configUrl =
  'https://jbrowse.org/code/jb2/main/test_data/volvox/config.json'
addRelativeUris(config, new URL(configUrl))

export default function ImportConfigJson() {
  const state = useCreateViewState({ config })
  return state ? <JBrowseApp viewState={state} /> : null
}