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

useCallback received a final argument... #41

Closed
sibuser opened this issue Oct 10, 2019 · 8 comments
Closed

useCallback received a final argument... #41

sibuser opened this issue Oct 10, 2019 · 8 comments
Labels

Comments

@sibuser
Copy link

sibuser commented Oct 10, 2019

I get this error when include a Chart component into my project.

useCallback received a final argument that is not an array (instead, received `function`). When specified, the final argument must be an array.
function MyChart(){
  const data = React.useMemo(
    () => [
      {
        label: "Series 1",
        data: [[0, 1], [1, 2], [2, 4], [3, 2], [4, 7]]
      },
      {
        label: "Series 2",
        data: [[0, 3], [1, 1], [2, 5], [3, 6], [4, 4]]
      }
    ],
    []
  );

  const series = React.useMemo(
    () => ({
      showPoints: false
    }),
    []
  );

  const axes = React.useMemo(
    () => [
      { primary: true, type: "linear", position: "bottom" },
      { type: "linear", position: "left" }
    ],
    []
  );
return (
      <div
        style={{
          width: "400px",
          height: "300px"
        }}
      >
        <Chart data={data} series={series} axes={axes} tooltip />
      </div>
)
}
@tannerlinsley
Copy link
Collaborator

tannerlinsley commented Oct 10, 2019 via email

@sibuser
Copy link
Author

sibuser commented Oct 11, 2019

I've managed to reproduce it with this React version

https://codesandbox.io/s/happy-vaughan-wf5pj

@keeganstothert
Copy link

keeganstothert commented Oct 11, 2019

i have the exact same issue, react 16.10.2 and react-charts 2.0.0-beta.4

@luzma87
Copy link

luzma87 commented Oct 28, 2019

having the same issue.. react 16.11.0 and react-charts 2.0.0-beta.4 :/

@sbuddala-fraedom
Copy link

I am having the same issue. "react": "16.12.0", "react-charts": "2.0.0-beta.4"

@sinamics
Copy link

having the same issue. "react": "^16.12.0", "react-charts": "^2.0.0-beta.4",

@chfritz
Copy link

chfritz commented Mar 12, 2020

The error stack shows it's an issue in here:

  getSeriesID = React.useCallback(Utils.normalizeGetter(getSeriesID), getSeriesID);

indeed getSeriesID seemed to have been a function in 2.0.0-beta.5, but this now seems to be fixed in 2.0.0-beta.6.

@tannerlinsley
Copy link
Collaborator

Beta doesn't even use this API/function any more, so I'm going to close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants