• Imports a part of the Nosto state to the component.

    Returns State

    import { useNostoAppState } from '@nosto/search-js/preact'

    export default () => {
    const pageType = useNostoAppState(state => state.pageType)

    return (
    <div>
    Page type is {pageType}
    </div>
    )
    }

    If the selector parameter is not provided, the full state is returned. Be mindful of the unnecessary rerenders it may cause.

    import { useNostoAppState } from '@nosto/search-js/preact'

    export default () => {
    const state = useNostoAppState()

    return (
    <div>
    Page type is {state.pageType}
    </div>
    )
    }
  • Imports a part of the Nosto state to the component.

    Type Parameters

    • Selected

    Parameters

    Returns Selected

    import { useNostoAppState } from '@nosto/search-js/preact'

    export default () => {
    const pageType = useNostoAppState(state => state.pageType)

    return (
    <div>
    Page type is {pageType}
    </div>
    )
    }

    If the selector parameter is not provided, the full state is returned. Be mindful of the unnecessary rerenders it may cause.

    import { useNostoAppState } from '@nosto/search-js/preact'

    export default () => {
    const state = useNostoAppState()

    return (
    <div>
    Page type is {state.pageType}
    </div>
    )
    }
MMNEPVFCICPMFPCPTTAAATR