This is React Componet which can be used in any React Application to provide the user with auto-fill/auto-complete keywords while writing content.
To run the Web Application on your local system download Node.js - https://nodejs.org/en/download/ . This will give you access to the node package manager which is essential to run the project .
- Open this cloned folder in the text editor of your choice.
- If you want to use the project using
npm
then that comes alongside when you download and install node js.
- Open the terminal and type in
npm install
, to install all the dependencies. - Run:
npm start
- Open http://localhost:3000 to view it in the browser.
- The page will reload if you make edits.
- After doing changes type
npm test
. This launches the test runner in the interactive watch mode. - See the section about running tests for more information.
- Run the command
npm run build
- Builds the app for production to the
build
folder. - It correctly bundles React in production mode and optimizes the build for the best performance.
- The build is minified and the filenames include the hashes. Your app is ready to be deployed!
- See the section about deployment for more information.
After typing npm start
in the terminal , the project can be used opened on http://localhost:3000.
The App Component is the parent compoent of AutoFill componet where the user can type input.The App component has essential functions and classes which are needed for the AutoFill Component to work effecintly.
The Auto fill component is a stateless contolled component which takes props from its parent , which report its channges to the parents and fetch results accordingly.
The Autofill will display an array of suggestion for each incomplete word and these arey dispalyed in the form of pills.
The AutoFill component has an event handler which calls the handleChange function whenever a change is done to the input.
The handle change function will make an api call for the incomplete word of the input and fetch suggestions from the server.
In an effort to minimise redundant API Calls we have used a Trie for which stores the suggestions for different prefexes. The Trie is stored in our Cache(local storage of user) and is reset every 30 seconds. The system is checked for pre-existing Trie in Cache whenever the component is rendered.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Please make sure to update tests as appropriate.
- Any system with basic configuration.
- Operating System : Any (Windows / Linux / Mac).
- Updated browser
- Node.js installed (If not download it here).
- Any text editor of your choice.
- Knowledge of git & github.
- JavaScript
- ReactJS