Demo video
wfa3-pages-demo.mp4
To get started:
- Clone this repository.
- Navigate to the project folder and run
npm install
to install the dependencies. - Run
npm run dev
to start the development server. - Open your browser and navigate to http://localhost:3000.
This project uses Next.js for server-side rendering and React for building the user interface. The main component in this project is Analyzer
, which renders a form with a textarea input and two buttons: one to analyze the text in the input, and another to download the results in JSON format.
The countWords
function takes a string of text as input and returns an object with key-value pairs where the keys are individual words in the text and the values are the frequency of each word. When the user submits the form, the handleSubmit
function is called, which uses the countWords
function to count the frequencies of the words in the input text and sets the results state using the setResults
function.
If there are results, the component renders a grid of boxes displaying each word and its frequency. When the user clicks the download button, the handleDownload
function creates a temporary anchor link with a data:
URI containing the JSON-encoded results data, sets the download
attribute to a filename based on the current date and time, triggers a click event on the anchor link, and then removes the anchor element from the DOM.
This project is licensed under the MIT license.
Made with ❤️ by Baniminator