- You cannot use any 3rd party libraries - only pure React and internal DOM functions.
- You should use typescript and write proper interfaces and types.
- It should have basic working CSS. No need for anything fancy (such as drop-shadows etc), but should look decent.
- No external state management libraries, only native React method.
- Use only functional component with hooks.
- The function to filter the data should be asynchronous. You can use mock data (such as a JSON array), but the function which uses it should be asynchronous (similar to a real REST call).
- Highlight the matching part of the text, in addition to showing it.
- Load data using a real API call to some resource.
- You need to handle all non-standard/edge use-cases - it should have a perfect user-experience.
pages
api
top-albums.tsx
- Next.js server-side API route.top-albums.json
- Mock data JSON array.
index.tsx
- Next.js entrypoint page.
styles
autocomplete.css
- Autocomplete CSS Stylesheet.
lib
Demo
- React function component that demonstrates the autocomplete interface.Autocomplete
- React function component with the autocomplete implementation.
I chose Next.js mainly for its JavaScript bundling mechanism and for the quicker setup it provides for this test.
- Clone this repo
npm install
to install all dependenciesnpm run dev
to start the local server
The app should now be up and running at http://localhost:3000 🚀