Code Monkey home page Code Monkey logo

keeperapp's Introduction

React Components - App.js, CreateArea.js, Note.js This repository contains code for three React components - App, CreateArea, and Note.

App.js The App component is responsible for rendering the header, footer, and CreateArea component. It also renders multiple Note components based on the notes stored in the state. The component contains two functions - addNote and deleteNote.

The addNote function takes in a new note as an argument and adds it to the notes array in the state. The deleteNote function takes in an ID as an argument and filters out the note with that ID from the notes array in the state.

CreateArea.js The CreateArea component is responsible for creating a form for taking notes. It imports React, useState from React, AddIcon from "@material-ui/icons/Add", and Fab from "@material-ui/core/Fab". The component has two states - isExpanded and note.

The handleChange function updates the note state with the name and value of the event target. The submitNote function calls onAdd with the note state as an argument and then sets the note state back to an empty object. The expand function sets isExpanded to true when the textarea is clicked on.

The component renders a form with an input field if isExpanded is true, a textarea with one or three rows depending on whether it is expanded or not, and a Fab button with an AddIcon that calls submitNote when clicked on.

Note.js The Note component imports DeleteIcon from "@material-ui/icons/Delete" and creates a function called Note. The handleClick() function is passed in as an argument to the onDelete() method, which is executed when the delete button is clicked.

The component returns a div with two children, one for the title and another for the content of the note. The Note component is exported.

Conclusion In summary, the App, CreateArea, and Note components work together to create a note-taking application in React. The App component renders the main UI, the CreateArea component handles the creation of new notes, and the Note component renders individual notes and handles their deletion.

keeperapp's People

Contributors

vishal2819 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.