fre.js
网站地址:fre.js.org | 收录时间:2020年06月03日 |
网站人气:366 次 | 所属分类:站长资源 |
网站语言:简体中文 | 网站评分: |
百度权重: | 搜狗权重: |
网站IP:104.26.8.84 | 网站编码:UTF-8 |
fre.js详细介绍
:ghost:类似于Concurrent的微小React16框架。
特征
- :tada:功能组件和挂钩API
- :confetti_ball:并发和挂起
- :telescope:键对帐算法
贡献者
Fre有很棒的代码,我们需要更多加入我们并共同改进。
useState
useEffect
useReducer
useLayout
useCallback
useMemo
useRef
useContext
useState 是基本API,它将接收初始状态并返回Array
您可以使用它很多次,重新渲染组件时可以使用新状态
useReducer而useState几乎是相同的,但useReducer需要一个全球性的减速
它是效果的执行和清除,由第二个参数表示
如果返回函数,则该函数可以进行清理:
More like useEffect, but useEffect queue in requestAnimationFrame, but useLayout is sync and block commitWork.
useMemo has the same parameters as useEffect, but useMemo will return a cached value.
useCallback is based useMemo, it will return a cached function.
挂钩API
useState
function App() { const [up, setUp] = useState(0) const [down, setDown] = useState(0) return ( <div> <h1>{up}</h1> <button onClick={() => setUp(up + 1)}>+</button> <h1>{down}</h1> <button onClick={() => setDown(down - 1)}>-</button> </div> ) }
useReducer
function reducer(state, action) { switch (action.type) { case 'up': return { count: state.count + 1 } case 'down': return { count: state.count - 1 } } } function App() { const [state, dispatch] = useReducer(reducer, { count: 1 }) return ( <div> {state.count} <button onClick={() => dispatch({ type: 'up' })}>+</button> <button onClick={() => dispatch({ type: 'down' })}>+</button> </div> ) }
useEffect
useEffect(f) // effect (and clean-up) every time useEffect(f, []) // effect (and clean-up) only once in a component's life useEffect(f, [x]) // effect (and clean-up) when property x changes in a component's life
function App({ flag }) { const [count, setCount] = useState(0) useEffect(() => { document.title = 'count is ' + count }, [flag]) return ( <div> <h1>{count}</h1> <button onClick={() => setCount(count + 1)}>+</button> </div> ) }
useEffect(() => { document.title = 'count is ' + count reutn () => { store.unsubscribe() } }, [])
useLayout
useLayout(() => { document.title = 'count is ' + count }, [flag])
useMemo
function App() { const [count, setCount] = useState(0) const val = useMemo(() => { return new Date() }, [count]) return ( <div> <h1> {count} - {val} </h1> <button onClick={() => setCount(count + 1)}>+</button> </div> ) }
useCallback
const cb = useCallback(() => { console.log('cb was cached') }, [])
fre.jsAlexa排名
全球排名 | 国家/地区 | 排名趋势 | 本地排名 | 人均PV | 人均UV |
---|---|---|---|---|---|
- | - | - | - | - | - |
fre.js域名Whois信息
查询域名: | 暂无信息 |
域名注册商: | - |
域名服务器: | - |
创建时间: | |
过期时间: | |
更新时间: | - |
fre.js域名备案信息
主办单位名称 | 主办单位性质 | 网站备案/许可证号 | 网站名称 | 网站首页网址 | 审核时间 |
---|---|---|---|---|---|
-- | -- | -- | -- | -- |
fre.js网站SEO信息
网站标题: | fre.js - 一个小而美的前端 MVVM 框架 |
网站关键词 : | fre.fre.js.前端框架. |
网站描述: | :ghost: Tiny React16 like framework with Concurrent.
:ghost:类似于Concurrent的微小React16框架。
特征
贡献者Fre有很棒的代码,我们需要更多加入我们并共同改进。
useState
useEffect
useReducer
useLayout
useCallback
useMemo
useRef
useContext
useState 是基本API,它将接收初始状态并返回Array
您可以使用它很多次,重新渲染组件时可以使用新状态
useReducer而useState几乎是相同的,但useReducer需要一个全球性的减速
它是效果的执行和清除,由第二个参数表示
如果返回函数,则该函数可以进行清理:
More like useEffect, but useEffect queue in requestAnimationFrame, but useLayout is sync and block commitWork.
useMemo has the same parameters as useEffect, but useMemo will return a cached value.
useCallback is based useMemo, it will return a cached function.
|
与fre.js相关推荐
网络科技
猜你喜欢
- 源码之家4年前
- V2EX4年前
- 网站SEO报告4年前
- Alexa全球排名4年前
- Alexa排名4年前
- SEO综合查询4年前
- 站长工具4年前
- 爱站网站排行榜4年前
- 站长源码下载站4年前
- YzmCMS4年前
最近更新
- 生命价值的励志文章2年前
- 联通客服工作总结2年前
- 学游泳作文400字5篇2年前
- 物竞天择适者生存作文2年前
- SpeXial《小太阳大月亮》歌词2年前
- 瞬间的永恒情感美文2年前
- 介绍太和殿的作文2年前
- 合同法学习心得体会范文4篇2年前
- 英语记叙文2年前
- 表示速度快的成语2年前
关注我们
49文章网提供了丰富的唯美、励志、伤感、正能量等经典文章.如果你需要找名人名言、诗词名句、好词好句等,相信在这里能够找到想要的.