import { State } from 'watch-state'; /** * Creates a `State` instance that can be passed as a static prop to child components. * Reactivity is activated only in components that call `useWatch` on the Observable. * This pattern optimizes re-renders: parent components don't re-render when state changes. * * @template S - The type of the state value * @param initial - Optional initial value for the state * @returns A `State` instance * * @example * ```tsx * // Basic usage // * * import { useWatch, useNewState } from '@watch-state/react' * * const Parent = () => { * const $count = useNewState(0) * * return * } * * const Child = ({ $count }) => { * const count = useWatch($count) * * return ( *
* {count} * *
* ) * } * ``` */ export declare function useNewState(...args: undefined extends T ? [T?] : [T]): State;