React SDK setup
Prerequisite
Node.js version 11.0.0 or higher
NPM version 6.0.0 or higher
Node dependencies:
react: ">=16.8.x"
react-dom: ">=16.8.x"
react-dates: "^21.8.0"
react-with-styles-interface-css: "^6.0.0"
mini-css-extract-plugin: "^0.9.0" or any equvalent css loader
webpack: "^4.43.0"
Steps for setup
To install the latest package in your project go to the terminal and install the package
https://github.com/hawksearch/react-hawksearch.git#latestnpm install git+https://github.com/hawksearch/react-hawksearch.git#latest
It will install the latest package in your preview application.
Create a directory for the hawksearch integration scripts and widgets (e.g. assets/js/hawksearch/react)
Create an inedx.jsx in this new directory and add it as an entry file in webpack.config.js alongside some build configuration
module.exports = { entry: { main: [ './assets/js/hawksearch/react/index.jsx' ... ] }, module: { rules: [ { test: /\.jsx$/, exclude: /node_modules/, use: { loader: 'babel-loader', options: { presets: [ '@babel/preset-react' ] }, } }, { test: /\.s?css$/, use: [ MiniCssExtractPlugin.loader, { loader: 'css-loader' }, 'sass-loader', ], } ] }, plugins: [ new MiniCssExtractPlugin({ filename: "main.css", }) ] ... }
Create widgets folder in the react resource directory (e.g. assets/js/hawksearch/react/widgets)
Open index.jsx for editing
Import all required styles
import 'react-hawksearch/dist/esm/react-hawksearch.css'; import 'rheostat/css/rheostat.css'; import 'react-dates/lib/css/_datepicker.css';
Import and register theme and interface
Add all widget references (if there aren’t any created, add these later)
Â
Build the JS resources (e.g. webpack --mode development)
Â
Next steps
Â