Currently, I am working on integrating the Algolia Places functionality into my next.js project using TypeScript.
- To begin, I executed
npm install places.js --save
- Next, I inserted
within my component.<input type="search" id="address-input" placeholder="Where are we going?" />
const Algolia = () => {
return (
<div>
<input
type="search"
id="address-input"
placeholder="Where are we going?"
/>
</div>
);
};
export default Algolia;
However, I have encountered a roadblock. I am unsure how to initialize the places.js library and where to include it in my project.
var places = require('places.js');
var placesAutocomplete = places({
appId: <YOUR_PLACES_APP_ID>,
apiKey: <YOUR_PLACES_API_KEY>,
container: document.querySelector('#address-input')
});