Skip to content

Data not populated at mount #368

Open
@maximelebastard

Description

@maximelebastard

Describe the bug
When using the provided example, no data is populated into the state.

To Reproduce
Use that example

import { useFetch } from "use-http";

function Data() {
  const {
    loading,
    error,
    data = [],
  } = useFetch(
    "https://myserver.com/?query=toto",
    {},
    []
  );

  return (
    <>
      {JSON.stringify(data, error, loading)}
    </>
  );
}

export default Data;

Expected behavior
The data appears into the data attribute

Actual behavior
The request is executed and visible into the Network tab of the Chrome Dev Tools, but no data is put in the state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions