kettanaito / atomic-layout

Build declarative, responsive layouts in React using CSS Grid.
https://redd.gitbook.io/atomic-layout
MIT License
1.13k stars 33 forks source link

useResponsiveProps always returns empty object initialy client-side #365

Open pindjur opened 1 year ago

pindjur commented 1 year ago

When:

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

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

return <h1 {..._props} />; };

3. Render it with some props, I used just children 
Hello


## 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"}

<!-- What would you expect to happen? -->

## Environment:

- node vesrion: `18`
- npm version: `9`
- atomic-layout version: `0.16.2`