Skip to content

Instantly share code, notes, and snippets.

@DanielBarbakadze
Created March 10, 2021 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanielBarbakadze/cc37b8283d61d07df39c2da7c67dcfd9 to your computer and use it in GitHub Desktop.
Save DanielBarbakadze/cc37b8283d61d07df39c2da7c67dcfd9 to your computer and use it in GitHub Desktop.
react-add-to-calendar-hoc-example
import AddToCalendarHOC from "react-add-to-calendar-hoc";
export default function ReactAddToCalendarHoCExample() {
const ATCDropdown = (args) => (
<ul className="atc-dropdown">
{args.children.map((link, i) => (
<li key={i}>{link}</li>
))}
</ul>
);
const ATCWrapper = (args) => (
<a onClick={args.onClick} className="atc-item" href="/">
{args.children}
</a>
);
const AddToCalendarDropdown = AddToCalendarHOC(ATCWrapper, ATCDropdown);
return (
<AddToCalendarDropdown
linkProps={{
className: "atc-dropdown-title"
}}
event={yourEventObject} // yourEventObject here
/>
);
}
@edencorbin
Copy link

Really agree with this, this helped me allot, and I found it missing in the examples. Perhaps commit the examples to the git repo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment