随笔分类 - 前端jira-hook学习笔记
前端jira-hook学习笔记
摘要:export const SearchPanel = ({ users, param, setParam }: SearchPanelProps) => { return ( <Form style={{ marginBottom: "2rem" }} layout={"inline"}> <For
阅读全文
摘要:// TS 中的typeof,是在静态环境运行的 // return (...[endpoint, config]: Parameters<typeof http>) => export const useHttp = () => { const { user } = useAuth(); // u
阅读全文
摘要:const apiUrl = process.env.REACT_APP_API_URL; interface Config extends RequestInit { token?: string; data?: object; } export const http = async ( endp
阅读全文
摘要:import React, { useState } from "react"; import { RegisterScreen } from "unauthenticated-app/register"; import { LoginScreen } from "unauthenticated-a
阅读全文
摘要:const AuthContext = React.createContext< | { user: User | null; register: (form: AuthForm) => Promise<void>; login: (form: AuthForm) => Promise<void>;
阅读全文
摘要:const AuthContext = React.createContext< | { user: User | null; register: (form: AuthForm) => Promise<void>; login: (form: AuthForm) => Promise<void>;
阅读全文
摘要:// 在真实环境中,如果使用firebase这种第三方auth服务的话,本文件不需要开发者开发 import { User } from "types/user"; const apiUrl = process.env.REACT_APP_API_URL; const localStorageKey
阅读全文
摘要:module.exports = (req, res, next) => { if (req.method "POST" && req.path "/login") { if (req.body.username "jack" && req.body.password "123456") { ret
阅读全文
摘要:export const useArray = <T>(initialArray: T[]) => { const [value, setValue] = useState(initialArray); return { value, setValue, add: (item: T) => setV
阅读全文
摘要:// 后面用泛型来规范类型 export const useDebounce = <V>(value: V, delay?: number) => { const [debouncedValue, setDebouncedValue] = useState(value); useEffect(()
阅读全文
摘要:在本节中我们使用到了 8 种类型: number, string, boolean, 函数,array, any, void, object 这一节我们接触到了平常使用中会接触到的大部分的类型,下面我们挨个梳理一遍: number:数字类型,包含小数、其他进制的数字 let decimal: num
阅读全文