# extendify/0.1.0/src/hooks/helpers.js

Extendify, version 0.1.0. 27 lines.

- Page: https://pluginprobe.com/plugins/extendify/0.1.0/code/src/hooks/helpers.js
- Raw: https://pluginprobe.com/plugins/extendify/0.1.0/raw/src/hooks/helpers.js
- Modified: 2022-01-06T18:08:32+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/extendify/0.1.0/code/src/hooks/helpers.js#L10-L20`.

```javascript
import { useRef, useEffect, useState } from '@wordpress/element'

export function useIsMounted() {
    const isMounted = useRef(false)

    useEffect(() => {
        isMounted.current = true
        return () => (isMounted.current = false)
    })
    return isMounted
}

export const useIsDevMode = () => {
    const [devMode, setDevMode] = useState(false)
    const handle = () => {
        setDevMode(window.location.search.indexOf('DEVMODE') > -1)
    }
    useEffect(() => {
        setDevMode(window.location.search.indexOf('DEVMODE') > -1)
        window.addEventListener('popstate', handle)
        return () => {
            window.removeEventListener('popstate', handle)
        }
    }, [])
    return devMode
}

```
