面包屑 面包react antd

React Native实现Toast轻提示和loading

# React Native 封装Toast ## 前言 > 使用react native的小伙伴都知道,官方并未提供轻提示组件,只提供了ToastAndroid API,顾名思义,只能再安卓环境下使用,对于ios就爱莫能助,故此,只能通过官方的核心组件,自行封装,实现Toast功能 ## 实现 * ......
loading Native React Toast

[React Typescript] Strongly typed HOC component

import { Router, useRouter } from "fake-external-lib"; export const withRouter = <TProps extends { router: Router }>( Component: React.ComponentType<T ......
Typescript component Strongly React typed

[React Typescript] Fixing forwardRef's Type

Fix forwardRef globally To jump ahead to the solution, uncommenting the following code from Stefan Baumgartner will globally override the value of for ......
Typescript forwardRef Fixing React Type

[React Typescript] Strongly type Shared props for multiple components (React.FC<propsType>)

import { Equal, Expect } from "../helpers/type-utils"; type InputProps = React.ComponentProps<"input">; const COMPONENTS = { text: (props) => { return ......

[React Typescript] Strongly type Render prop

1. React.ReactNode import { useState } from "react"; import { createPortal } from "react-dom"; import { Equal, Expect } from "../helpers/type-utils"; ......
Typescript Strongly Render React type

[React Typescript] Strongly Typing Lazy Loaded Components with Generics

Navigating to the type definition for lazy by CMD + click in local VS Code, or in the DefinitelyTyped repo. We can see the following definition: funct ......

React加载组件后自动触发某函数,而不需要点击按钮

##问题 在项目中使用了ReactToPrint来实现打印,但是trigger属性中的按钮需要点击才能执行打印。 期望能在组件加载完成时自动执行打印方法。 ## 解决 可在组件加载完成时,通过id获取组件,并执行该组件的click方法。 代码如下: ``` import React, { useRe ......
函数 组件 按钮 React

react hooks中使用promise.all

useEffect(async () => { const getFirstResponse = async () => { try { return await axios.get('http://first-api', { params: { carId: id }, }); } catch ( ......
promise react hooks all

react-pdf在部分iOS手机上加载pdf失败问题解决

*最近项目快结束了,测试提了一个bug,iOS手机上加载pdf一直在转圈,加载不出来内容。看到这个bug,在电脑上和安卓手机上没有问题,iOS手机中打开确实又问题,初步确定为app问题。我们的项目是集成在客户的app里的,可能是app内的WebView和Safari有一些差异导致的问题。* 1. 首 ......
react-pdf pdf 部分 问题 手机

pdfjs-dist v2.11.338写个react demo

app.jsx ```jsx import './App.css' import * as pdfjs from "pdfjs-dist"; import "pdfjs-dist/web/pdf_viewer.css"; import { useEffect, useRef, useState } ......
pdfjs-dist 11.338 pdfjs react dist

umi-qiankun——子应用vue+element返回主项目react+antdReact,样式丢失问题

参考: [Bug]结合 styled components 使用时 dynamicHeadAppend 存在缺陷 #617 https://github.com/umijs/qiankun/issues/617 qiankun官网 https://qiankun.umijs.org/zh/api/# ......
umi-qiankun 样式 antdReact qiankun element

[React Typescript] Updating the Global Namespace for an Additional Attribute

I want to add a common attribute to dom element globally: <> <div testId="123" /> <audio testId="123" /> <video testId="123" /> <a testId="123" /> <ab ......

创建web应用程序,React和Vue怎么选?

React和Vue都是创建web应用程序的绝佳选择。React得到了科技巨头和庞大的开源社区的支持,代码库可以很大程度地扩展,允许你创建企业级web应用程序。React拥有大量合格甚至优秀的开发人员粉丝,可以解决你在开发阶段可能遇到的任何问题。 毫无疑问,React是创建跨平台解决方案的最佳框架。V... ......
应用程序 程序 React web Vue

React Router 6 快速上手

## 1.概述 1. React Router 以三个不同的包发布到 npm 上,它们分别为: 1. react-router: 路由的核心库,提供了很多的:组件、钩子。 2. **react-router-dom:** 包含react-router所有内容,并添加一些专门用于 DOM 的组件,例如 ......
Router React

react-player学习

## 一个适用于 react 的视频插件—react-player ``` 说明文档 转载说明:来源于npm库中的readme.md 侵权删 调试工具地址: https://cookpete.com/react-player 1. 可以自动播放 2. 可以实现画中画、倍速、可控播放等功能 ``` R ......
react-player player react

[React Typescript] ElementType, ComponentType

The ElementTypetype helper is a bit unusal because it accepts some props and derives what types of components would be able to recieve those props. He ......
ComponentType ElementType Typescript React

[React Typescript] JSX.IntrinsicElements

interface IntrinsicElements { // HTML a: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>; abbr: React.Detail ......
IntrinsicElements Typescript React JSX

[React Typescript] React.ReactNode > React.ReactElement = JSX.Element = React.JSX.Element

This is ReactNode: type ReactNode = | ReactElement | string | number | ReactFragment | ReactPortal | boolean | null | undefined This is React.ReactEle ......
React Element ReactElement Typescript JSX

[React Typescript] React namespace

export = React; export as namespace React; declare namespace React { // // React Elements // type ElementType<P = any> = { [K in keyof JSX.IntrinsicEl ......
React Typescript namespace

[React Typescript] Inferring Type Arguments in Curried Hooks

import { DependencyList, useMemo, useState } from "react"; import { Equal, Expect } from "../helpers/type-utils"; const useCustomState = <TValue>(init ......
Typescript Inferring Arguments Curried React

[React Typescript] Function overload in React hook

import { useState } from "react"; import { Equal, Expect } from "../helpers/type-utils"; type UseStateReturnValue<T> = { value: T; set: React.Dispatch ......
React Typescript Function overload hook

react hooks 子传父

父组件中: import React,{useState } from "react"; import HeXiaoDialog from "../components/hexiaoDialog"; //引入的子组件 function ShuoMing(props){ let [flag , set ......
react hooks

react项目搭建-路由封装

router v6 路由统一管理与添加,对是否登录进行判断。 1.使用脚手架创建项目 新建一个文件夹 ,在文件夹内部打开命令行工具。 执行命令:npx create-react-app 项目名字 将项目放在开发工具中,打开项目终端运行项目(npm start / yarn start) 注:npx命 ......
路由 项目 react

React请求机制优化思路

说起数据加载的机制,有一个绕不开的话题就是前端性能,很多电商门户的首页其实都会做一些垂直的定制优化,比如让请求在页面最早加载,或者在前一个页面就进行预加载等等。 ......
思路 机制 React

React面试1

1.什么是虚拟DOM?虚拟DOM是真实DOM在内存中的表示,ul的表示形式保存在内存中,并且与实际的DOM同步,这是一个发生在渲染函数被调用和元素在屏幕上显示的步骤,整个过程被称为调和 2.类组件和函数组件之间的区别是什么?类组件可以使用其他特性,如状态和生命周期钩子,并且他有this 函数组件只能 ......
React

[React Typescript] Discriminated Tuples in Custom Hooks

import { useEffect, useState } from "react"; export type Result<T> = | ["loading", undefined?] | ["error", Error] | ["success", T]; export const useDa ......
Discriminated Typescript Custom Tuples React

一文了解 history 和 react-router 的实现原理

>我们是[袋鼠云数栈 UED 团队](http://ued.dtstack.cn/),致力于打造优秀的一站式数据中台产品。我们始终保持工匠精神,探索前端道路,为社区积累并传播经验价值。 >本文作者:[霜序](https://luckyfbb.github.io/blog) ## 前言 在前一篇文章中 ......
react-router 原理 history router react

[React Typescript] Well typed a React Context provider

import React from "react"; import { Equal, Expect } from "../helpers/type-utils"; const createRequiredContext = <T extends any>() => { const context = ......
React Typescript provider Context typed

[React Typescript] Fixing type inference in a Custom React Hook

// Problem import { useState } from "react"; import { Equal, Expect } from "../helpers/type-utils"; export const useId = (defaultId: string) => { cons ......
React Typescript inference Fixing Custom

Taro react 插件提供外部插件引用

项目结构 projectName |-pages/index |-plugin |-components |-avatar index页面中引用: import Taro from '@tarojs/taro' import { Component, PropsWithChildren } from ......
插件 react Taro