Download react-query/examples/solid/astro/src/utils/index.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 483 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/examples/solid/astro/src/utils/index.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/examples/solid/astro/src/utils/index.ts
-
curl -L -o index.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-query/examples/solid/astro/src/utils/index.ts
483 Bytes
| import { createSignal } from 'solid-js' | |
| export const getSearchParams = (init: string) => { | |
| const [search, setSearch] = createSignal(init) | |
| if (typeof window !== 'undefined') { | |
| window.addEventListener('popstate', () => { | |
| const location = window.location | |
| const params = new URLSearchParams(location.search) | |
| setSearch(params.get('id') || '') | |
| }) | |
| } | |
| return search | |
| } | |
| export const properCase = (str: string) => | |
| str.charAt(0).toUpperCase() + str.slice(1) | |