Simple Solr connector for React.js

We’ve just published a simple (60 lines of code) React.js component to npm which makes it easy to perform searches on a Solr 6 instance and get the data into the app to display. Unlike Twigkit or Searchkit this is not a UI library – it is just a connector. If you use it you will have to implement all the UI components yourself. The npm package name is react-solr-connector and the code is available on GitHub (Apache 2.0 licence).

react-solr-connector provides a React component to contain your app. This component injects a prop into the app which includes a callback for performing a search. When the search results are available, the prop is updated so that the app can re-render. For full details, see README.md.

This package currently provides the bare minimum functionality in order to be useable, and requires knowledge of the Solr API in order to implement a working search app. I intend to start adding helper functions to the package to make this easier.

react-solr-connector is not the right choice if you are using Redux or another state management library. I may implement a Redux reducer for Solr at some point (although it appears that there is at least one other person working on this).

New:  A simple facetted search app with highlighting which uses the React Solr connector.

4 thoughts on “Simple Solr connector for React.js

  1. Can you please provide some details about how to run your example? Since it always says there is a bundle.js file not found.

    • bundle.js should be created dynamically by the webpack dev server when you execute npm start, as described in README.md. Could you please copy and post the output when you run this command?

  2. Hi,
    Nice Article.
    Cloud you explain the which is better between angular JS and react JS as a career for a beginner?
    regards,
    ReactJS Geek

    • Hi Ramya, thanks!

      My perception is that React is much more popular at the moment, so that may influence your choice. I don’t have any experience of Angular 2, but I have found developing in React to be much more of a pleasure than Angular 1.
      – Tom

Leave a Reply

Your email address will not be published. Required fields are marked *