Skip to content

Instantly share code, notes, and snippets.

@Bitaru
Created February 2, 2021 11:58
Show Gist options
  • Save Bitaru/df06d9398ffbb94b543473562512eaa6 to your computer and use it in GitHub Desktop.
Save Bitaru/df06d9398ffbb94b543473562512eaa6 to your computer and use it in GitHub Desktop.
react-bundle-in-class-component
import React from 'react';
import useFindify from '@findify/react-bundle';
import { useHistory } from 'react-router';
export default ({ type, config, children }) => {
const history = useHistory();
const [container, isReady, hasError] = useFindify({ type, config, history });
return children({ container, isReady, hasError });
}
import React from 'react';
import FindifyWidget rom './FindifyWidget';
export default class App extends React.Component{
render() {
return (
<FindifyWidget type='search'>
{
({ container, isReady, hasError }) => (
<div ref={container} />
)
}
</FindifyWidget>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment