REACT - Datepicker error

Asked

Viewed 242 times

1

Good morning! I’m trying to use datepicker components in React. I’m using materialize, but even the component of it is generating the same error. I am currently trying to use the React-jqueryui-datepicker.

In this passage:

render () {
        return <input
            type="text"
            ref="datepicker"
            {...this.props}
            />
    }

error is generated:

Module parse failed: Unexpected token (17:9)
You may need an appropriate loader to handle this file type.

I have noticed that any component that has this key scheme + ... generates this error, as shown: {...this.props}

I’m starting on React, have you ever come across this error? I would be referencing something incorrectly?

  • @t-Orges you are using the React-cli?

  • Yes, I am, William

  • @t-Bugs by error seems some problem or with the import plugin or any problem on webpack. Update your question with date-Picker import and your webpack.config

1 answer

0

Try to use the component as it says in the documentation by importing the component and referencing it.

import DatePicker from 'react-jqueryui-datepicker';

function changeHandler(e){
    //e is a momentJS DateTime instance
}

 <DatePicker 
    onChange={changeHandler} />

Browser other questions tagged

You are not signed in. Login or sign up in order to post.