Home > @theatre/core > getProject

getProject() function

Returns a project of the given id, or creates one if it doesn't already exist.

Signature:

export declare function getProject(id: string, config?: IProjectConfig): IProject;

Parameters

Parameter Type Description
id string
config IProjectConfig

Returns:

IProject

Remarks

If @theatre/studio is also loaded, then the state of the project will be managed by the studio.

[Learn more about exporting](https://docs.theatrejs.com/in-depth/#exporting)

Example 1

Usage:

import {getProject} from '@theatre/core'
const config = {} // the config can be empty when starting a new project
const project = getProject("a-unique-id", config)

Example 2

Usage with an explicit state:

import {getProject} from '@theatre/core'
import state from './saved-state.json'
const config = {state} // here the config contains our saved state
const project = getProject("a-unique-id", config)