0

Refer to this topic How can I use Pikaday with ReactJS?

Here my configurations,

Importing

import Pikaday from 'pikaday'
import '../../node_modules/pikaday/css/pikaday.css';

Create reference

constructor (params) {
    super(params)
    this.myRef = React.createRef()
  }

Create pikaday object

componentDidMount() {
        new Pikaday({
            field: this.myRef.current,
            format: 'MM/DD/YYYY',
            onSelect: null,
        });
    }

Rendering

render() {
        return (
            <div>
                <input type='text'  ref={this.myRef} />
        ...

There is nothing occur when I clicked on the input! Did I miss something? Please help!

webmastx
  • 683
  • 1
  • 8
  • 30
  • I think you copy/pasted the wrong code. You're using the original poster's, which is not working. refer to the answer – Andrew Feb 15 '20 at 08:52
  • @Andrew I can't find working code on the post! Appreciate much if you suggested any working one thanks. – webmastx Feb 15 '20 at 09:52

0 Answers0