We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
You can continue the conversation there. Go to discussion →
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
e.g ahooks How to use ahooks together
const { data, run, cancel } = useRequest(getUsername, { pollingInterval: 3000, });
e.g 2 const state2 = proxy({ get rrr(){return data?.message}}); How to use it reasonably
"use client"; import React, { useState } from 'react'; import { proxy, useSnapshot } from 'valtio'; import { useQuery } from '@shined/react-use'; const state = proxy({ count: 0, text: '' }); const fetchData = () => new Promise((resolve) => { setTimeout(() => { resolve({ message: 'Hello, World!' }); }, 1000); }); export default function Home() { const snap = useSnapshot(state); const [count, setCount] = useState(0); const { loading, data, error, run } = useQuery(fetchData, { manual: true }); const state2 = proxy({ get rrr(){return data?.message}}); async function add() { if (loading) return; await run(); console.log('更新的文本:', state2.rrr); } function add2() { setCount(3); console.log('当前计数:', count); } return ( <div> <div> <span>{snap.text}</span> <button onClick={add}>测试</button> </div> <div> <span>{count}</span> <button onClick={add2}>测试2</button> </div> </div> ); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
e.g ahooks How to use ahooks together
e.g 2 const state2 = proxy({ get rrr(){return data?.message}}); How to use it reasonably
The text was updated successfully, but these errors were encountered: