react-places-autocomplete icon indicating copy to clipboard operation
react-places-autocomplete copied to clipboard

error when using getInputProps

Open jmayergit opened this issue 6 years ago • 1 comments

In my component I get the following error when attempting to use getInputProps,

Module build failed (from ./node_modules/next/dist/build/webpack/loaders/next-babel-loader.js):
TypeError: Cannot read property '0' of null

I'm using Next.js. I have the places library loaded in my project. I copied much of the documentation's code. I'm not sure why this method is giving me an error.

Any help is appreciated.

jmayergit avatar Aug 19 '19 21:08 jmayergit

The problem lies with next.js but is relevant when using this library.

https://github.com/zeit/styled-jsx/issues/539 https://github.com/zeit/next.js/issues/6057

The spread syntax operator is the issue. Removing the styled jsx tags solves the issue.

I ended up creating a separate component to quarantine the input element. I styled this component elsewhere in the project using global tags.

jmayergit avatar Aug 20 '19 18:08 jmayergit