-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
Would be nice to have exported types for outer props.
Consider the following implementation:
import { useContainerQuery } from 'react-container-query';
import classnames from 'classnames';
const query = {
foo: { minWidth: 320 }
};
const App = () => {
const [classes, ref] = useContainerQuery(query, {});
return <div ref={ref} className={classnames(classes)}>...</div>
};
It would be handy to know the type of query
without having to infer from value.
Current workaround solution:
type Query = Parameters<typeof useContainerQuery>[0];
besides this is ugly to declare it this way, it's also dangerously to always assume it will be the first parameter (future proof wise).
Suggested solution:
import type { Query } from 'react-container-query';
import { useContainerQuery } from 'react-container-query';
const queries:Query = {
foo: { minWidth: 320 }
};
const App = () => {
const [classes, ref] = useContainerQuery(queries, {});
return <div ref={ref} className={classnames(classes)}>...</div>
};
Metadata
Metadata
Assignees
Labels
No labels