Skip to content
New issue

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

If React Hooks surport useState(await ...) to getData,we can used in ssr be better #14986

dazjean opened this issue Mar 1, 2019 · 1 comment


None yet
2 participants
Copy link

commented Mar 1, 2019

I am new gay。
we konw Hooks can only be called inside the body of a function component,but if hooks can suppert it we can easy get Default data in ssr,becauces effect not be call by ssr


let APP =  async() => {
    let initState = async () => {
        let response = await fetch('http://localhost:9991/mock/count.json');
        let listData = await response.json();
        return listData.count;
    const [count, setCount] = useState(await initState());
    return (


This comment has been minimized.

Copy link

commented Mar 1, 2019

This is planned — although not with this specific API.

@gaearon gaearon closed this Mar 1, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.