--- title: createSynchronizable sidebar_position: 42 # Use alphabetical order --- import * as ApiCreateSynchronizableSnippet from './_examples/apiCreateSynchronizable'; import ApiCreateSynchronizableSource from '!!raw-loader!./_examples/apiCreateSynchronizable'; # createSynchronizable Creates a new [Synchronizable](./synchronizable.mdx) holding the provided initial value. Returns the created Synchronizable. By default it creates a [Synchronizable Dynamic](./synchronizable.mdx#synchronizable-dynamic). You can pass a config option to create [Synchronizable Fixed](./synchronizable.mdx#synchronizable-fixed) instead. ## Reference
Type definitions ```typescript function createSynchronizable( initialValue: TValue, config: SynchronizableConfig & { fixedType: true } ): FixedSynchronizable; function createSynchronizable( initialValue: TValue, config?: SynchronizableConfig ): Synchronizable; type SynchronizableConfig = { fixedType?: boolean; }; ```
## Arguments ### initialValue The initial value to be held by the created Synchronizable. As it has to be serialized before passing to C++, it must be one of the supported types listed in the [Serializable](./serializable.mdx) documentation. With the [`fixedType` option](#config) it isn't serialized and must be a `number` or a `boolean`. ### config Optional configuration for the Synchronizable. An object with the following properties: - `fixedType` - when `true`, the created [Synchronizable Fixed](./synchronizable.mdx#synchronizable-fixed) stores its `number` or `boolean` value directly in native memory, without serialization, and exposes the additional [`setDirty`](./synchronizable.mdx#setdirty) method. Defaults to `false`. ## Remarks {/* TODO: Rewrite this remark for 1.0, which has no Legacy Eval Mode. */} - In [Legacy Eval Mode](../bundleMode/overview.mdx#legacy-eval-mode), `createSynchronizable` can be called only on the [RN Runtime](../concepts/runtimeKinds.mdx#rn-runtime). In Bundle Mode, it can be called on any Runtime.