Function useAppStateSelector

  • Preact hook that imports a part of current state to the component.

    This hook is preferred over useAppState. Unlike useAppState, useAppStateSelector will only trigger a component render when the selected value changes.

    Type Parameters

    • Selected

    Parameters

    Returns Selected

    import { useAppStateSelector } from '@nosto/preact'

    export default () => {
    const query = useAppStateSelector(state => state.query)

    return <div>
    Searching for {query.query}
    </div>
    }