EcosystemConfig
The config object passed to the createEcosystem()
factory.
Definition
interface EcosystemConfig<
Context extends Record<string, any> | undefined = any
> {
atomDefaults?: {
ttl?: number
}
complexParams?: boolean
context?: Context
destroyOnUnmount?: boolean
flags?: string[]
id?: string
onReady?: (
ecosystem: Ecosystem<Context>,
prevContext?: Context
) => MaybeCleanup
overrides?: AnyAtomTemplate[]
ssr?: boolean
}
All fields are optional. It is recommended to at least pass an id.
A boolean. Default false
. Whether "complex" atom and selector params should be allowed.
An object. The initial context for the ecosystem.
An object. This object currently accepts a single optional property - ttl
. If specified, this ttl
will be used as the ttl
for all atoms in the ecosystem that don't specify one.
A boolean. Defaults to false
for ecosystems created via createEcosystem()
. Defaults to true
for ecosystems created automatically by rendering an <EcosystemProvider>
.
Whether the ecosystem should destroy itself when its last <EcosystemProvider>
unmounts. Can be useful for testing.
An array of strings. Will be set as the ecosystem's flags.
A string. Identifies the ecosystem in the internal store
and in dev tools. If no id is specified when creating the ecosystem, one will be generated randomly.
A function. Will be set as the ecosystem's onReady function.
An array of atom templates. Will be mapped into the ecosystem's overrides object.
Used for Dependency Injection.
A boolean. Default false
. Turns on SSR mode for the entire ecosystem.
See the SSR guide.