Как использовать пакет «algolia-place-реагировать» npm в React - PullRequest
0 голосов
/ 05 февраля 2019

Я пытаюсь установить этот пакет в своем приложении реакции, но продолжаю получать:

Module not found: Can't resolve 'algolia-places-react' in...

Вот репозиторий github: https://github.com/kontrollanten/algolia-places-react

Пока я установилпакет с:

npm install algolia-places-react --save

, затем создайте новый файл компонента с предоставленным примером в документации по github:

import React from 'react';
import AlgoliaPlaces from 'algolia-places-react';

const Places = () => {
  return (
    <AlgoliaPlaces
      placeholder='Write an address here'

      options={ {
        appId: 'my-app-id',
        apiKey: 'sharing-is-caring',
        language: 'sv',
        countries: [ 'se' ],
        type: 'city',
        // Other options from https://community.algolia.com/places/documentation.html#options
      } }

      onChange={ ({ query, rawAnswer, suggestion, suggestionIndex }) => 
        console.log('Fired when suggestion selected in the dropdown or hint was validated.') }

      onSuggestions={ ({ rawAnswer, query, suggestions }) => 
        console.log('Fired when dropdown receives suggestions. You will receive the array of suggestions that are displayed.') }

      onCursorChanged={ ({ rawAnswer, query, suggestion, suggestonIndex }) => 
        console.log('Fired when arrows keys are used to navigate suggestions.') }

      onClear={ () => 
        console.log('Fired when the input is cleared.') }

      onLimit={ ({ message }) => 
        console.log('Fired when you reached your current rate limit.') }

      onError={ ({ message }) => 
        console.log('Fired when we could not make the request to Algolia Places servers for any reason but reaching your rate limit.') }
    />
  );  
}

export default Places

Затем я планирую экспортировать этот компонент, но у меня есть эта ошибка.Может кто-нибудь объяснить, как использовать этот пакет.Почему модуль не найден?БЛАГОДАРЯ

...