jcsmorais / shortcut-buttons-flatpickr

Flatpickr's plugin that provides users an alternative way to interact with the datetime picker.
MIT License
26 stars 15 forks source link

How to use in react #6

Closed kenzouno1 closed 5 years ago

kenzouno1 commented 5 years ago

I like this plugin but i can't import to my react project. i try import but always error shortcutButtonsPlugin is not defined

import 'shortcut-buttons-flatpickr'; import { ShortcutButtonsPlugin } from 'shortcut-buttons-flatpickr'; import ShortcutButtonsPlugin from 'shortcut-buttons-flatpickr';

jcsmorais commented 5 years ago

@kenzouno1 can you try the following?

import { ShortcutButtonsPlugin } from 'shortcut-buttons-flatpickr/dist/types/index.d';

// ...

flatpickr('#calendar', {
    // flatpickr options
    plugins: [
        ShortcutButtonsPlugin({
            // shortcut buttons plugin options
        }),
    ],
});

Let me know if it works, or in case it doesn't, which error messages you're getting.