Skip to content

useResponsiveProps always returns empty object initialy client-side #365

@pindjur

Description

@pindjur

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions