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

Warning about props not matching after page reload with SSR #60

Open
Bradzer opened this issue Feb 23, 2022 · 0 comments
Open

Warning about props not matching after page reload with SSR #60

Bradzer opened this issue Feb 23, 2022 · 0 comments

Comments

@Bradzer
Copy link

Bradzer commented Feb 23, 2022

I'm using Next.js with SSR.

After saving my form data in local storage and refreshing the page, my form renders with the correct values but I get the following warning, although I'm using a dummy storage object like suggested in the readme: Warning: Prop 'aria-valuenow' did not match. Server: "10000" Client: "11000".

Here is the relevant part of my code:

const dummyStorage = {
  getItem: () => null,
  setItem: () => {},
  removeItem: () => {},
};

export default function createClient() {
  const [formInitialValues, setFormInitialValues, writeErrors] =
    useStorageState(
      typeof window !== "undefined" ? localStorage : dummyStorage,
      "awaji",
      {
        lastName: "",
        firstName: "",
        gender: "male",
        dateOfBirth: "",
        initialCredit: 10000,
      }
    );

  const onSubmit = useCallback((values, actions) => {
    console.log(values);
    setFormInitialValues(values);
  }, []);

// rest of the code...

Any way to properly fix this ?

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

No branches or pull requests

1 participant