Skip to content

Instantly share code, notes, and snippets.

@tetrashine
Created January 21, 2022 14:54
Show Gist options
  • Save tetrashine/a23d83a2ca6997b0a05e96ef14dbee2b to your computer and use it in GitHub Desktop.
Save tetrashine/a23d83a2ca6997b0a05e96ef14dbee2b to your computer and use it in GitHub Desktop.
const cqlHoc = (Component) => {
return (props) => {
const { layer, attr, remainingProps } = props;
const generateCql = (attr, values) => `${attr} IN (${values.map(_ => `'${_}'`).join(',')})`;
return <Component
{...remainingProps}
onChange={(selected) => {
layer.setCql(generateCql(attr, selected));
}}
/>;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment