diff --git a/src/routes/reference/component-apis/create-context.mdx b/src/routes/reference/component-apis/create-context.mdx index 7ef06f310..85a39fcf0 100644 --- a/src/routes/reference/component-apis/create-context.mdx +++ b/src/routes/reference/component-apis/create-context.mdx @@ -23,15 +23,16 @@ For example: ```ts title="/context/counter.ts" import { createContext } from "solid-js"; -export const DEFAULT_COUNT = 0 -const INTIAL_STORE_SETTER = { - increment: () => void, - decrement: () => void +export const INITIAL_COUNT = 0; + +const INITIAL_STORE_SETTER = { + increment: () => {}, + decrement: () => {} }; export const CounterContext = createContext([ { count: INITIAL_COUNT }, - INTIAL_STORE_SETTER + INITIAL_STORE_SETTER ]); ``` @@ -39,19 +40,19 @@ With the context created in its own module, you can use to instantiate the conte ```ts title="/context/counter-component.tsx" import { createStore } from 'solid-js/store'; -import { CounterContext, DEFAULT_COUNT } from "./counter.ts"; +import { CounterContext, INITIAL_COUNT } from "./counter.ts"; export function CounterProvider(props) { - const [value, setValue] = createStore({ count: props.initialCount || DEFAULT_COUNT }) + const [value, setValue] = createStore({ count: props.initialCount || INITIAL_COUNT }) - const counter = [ + const counter = [ value, { increment() { setValue("count", currentCount => currentCount + 1) }, decrement() { - setValue("count", currentcount => currentCount - 1) + setValue("count", currentCount => currentCount - 1) }, }, ] @@ -98,4 +99,4 @@ interface Context { } function createContext(defaultValue?: T): Context -``` \ No newline at end of file +```