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

useResponsiveProps always returns empty object initialy client-side #365

Open
pindjur opened this issue Sep 14, 2023 · 0 comments
Open

useResponsiveProps always returns empty object initialy client-side #365

pindjur opened this issue Sep 14, 2023 · 0 comments

Comments

@pindjur
Copy link

pindjur commented Sep 14, 2023

When:

  1. Create the following component:
import { useResponsiveProps } from "atomic-layout";

const Heading = (props) => {
  const _props = useResponsiveProps(props);
  console.log(_props);

  return <h1 {..._props} />;
};
  1. Render it with some props, I used just children
<Heading>Hello</Heading>

Current behavior:

Props are empty object initialy, then are populated after re-render. With SSR I got hydration mismatch error from React, because props were {children:"Hello"} on server, but on client they are initialy empty object.

Expected behavior:

props are: {children:"Hello"}

Environment:

  • node vesrion: 18
  • npm version: 9
  • atomic-layout version: 0.16.2
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