repo
stringlengths
8
123
branch
stringclasses
178 values
readme
stringlengths
1
441k
description
stringlengths
1
350
topics
stringlengths
10
237
createdAt
stringlengths
20
20
lastCommitDate
stringlengths
20
20
lastReleaseDate
stringlengths
20
20
contributors
int64
0
10k
pulls
int64
0
3.84k
commits
int64
1
58.7k
issues
int64
0
826
forks
int64
0
13.1k
stars
int64
2
49.2k
diskUsage
float64
license
stringclasses
24 values
language
stringclasses
80 values
Thaliaraujo/aluraPlay
main
<p align="center"> <img src="https://imgur.com/J3hD21O.png" alt="Javascript: criando requisições"> </p> <hr> <p align="center"> <img src="https://github.com/MonicaHillman/aluraplay-requisicoes/blob/main/img/logo.png" alt="Logo da Alura"> </p> <p align="center">Página inicial e formulário de cadastro de vídeos da AluraPlay, uma plataforma de compartilhamento de vídeos.</p> ## Tecnologias utilizadas no projeto durante o curso * Javascript * NodeJS * Json-server ## Outras tecnologias utilizadas no projeto * HTML * CSS ## Screenshots ![Screenshot da tela inicial do AluraPlay](https://imgur.com/aymxEsh.png) ![Screenshot da tela do formulário do AluraPlay](https://imgur.com/ShNADf2.png)
Página inicial e formulário de cadastro de vídeos da AluraPlay, uma plataforma de compartilhamento de vídeos.
javascript,requisicoes-em-api,tratamento-de-erro
2023-08-07T16:39:08Z
2023-12-12T21:29:18Z
null
1
0
18
0
0
2
null
null
CSS
nasa-gcn/web-dev-bootcamp
main
# Welcome to the Modern Web Dev Boot Camp ## Prerequisites - Create a [GitHub account](https://github.com) - Install, on your own computer: - [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) - [AWS CLI](https://aws.amazon.com/cli/) - [VS Code](https://code.visualstudio.com/download) - [Node.js](https://nodejs.org/en/download) 18.x or newer - [Slack](https://slack.com/downloads/) ## Tutorial Outline <table> <thead> <tr> <th>Time</th> <th>Topic</th> <th>Presenter</th> </tr> </thead> <tbody> <tr><td colspan="3"><b>Monday, 08/14/2023, GSFC Building 34 Room E215</b></td></tr> <tr><td>10:00-10:30</td><td>Orientation, Prerequisites Office Hours</td><td></td></tr> <tr><td>10:30-11:00</td><td><a href="syllabus/git-lecture.md">Git Lecture</a></td><td>Dakota</td> <tr><td>11:00-12:00</td><td><a href="syllabus/git-exercise.md">Git Exercise</a></td><td>Dakota</td> <tr><td>13:00-14:00</td><td><a href="syllabus/git-exercise.md">Git Exercise (continued)</a></td><td>Dakota</td> <tr><td>14:00-16:30</td><td><a href="syllabus/modern-javascript.md">Modern JavaScript Lecture</a></td><td>Courey</td> <tr><td>14:00-16:30</td><td><a href="syllabus/web-dev-exercise.md">Web Dev Exercise</a></td><td>Courey</td> <tr><td colspan="2"><b>Tuesday, 08/15/2023, GSFC Building 34 Room W305</b></td><td></td></tr> <tr><td>09:00-11:00</td><td><a href="syllabus/tutorial-walkthrough.md">Tutorial Walkthrough</a></td><td>Courey</td> <tr><td>13:00-13:30</td><td><a href="syllabus/cloud-basics/lecture.md">Cloud Basics Lecture</a></td><td>Leo</td> <tr><td>13:30-14:00</td><td><a href="syllabus/cloud-basics/exercise.md">Cloud Basics Exercise</a></td><td>Leo</td> </tbody> </table> ## About This Repository This repository is based on [Americana](https://github.com/nasa-gcn/americana-stack), a project template for [Remix](https://remix.run) preconfigured with the [US Web Design System (USWDS)](https://designsystem.digital.gov). To start a fresh project from that template _without_ the tutorial materials, run this command: npx create-remix@latest --template nasa-gcn/americana-stack Learn more about [Remix Stacks](https://remix.run/stacks).
A tutorial on modern web development and cloud engineering for astronomers working on science data portals at NASA.
aws,javascript,jsx,nasa,remix-run,typescript,uswds
2023-08-07T19:49:03Z
2024-04-11T15:14:45Z
null
15
48
103
1
11
2
null
null
JavaScript
IotchulindraRai/Online-Food-Ordering-System-using-PHP
main
Online-Food-Ordering-System-using-PHP The Online Food Ordering System Project, this system can be defined as software web application or mobile app that allows to accept order placed over the online for hungry customers to view the food restaurant.Not only that we can see the Restaurant in a Map in a page.We have added functionality of autheddication of admin /manager and customer where there is a function of CRUD based on responsibility. Name of Project: **Online Food Ordering System** Used Language: PHP Used Database: MySQL Interface Design: JQuery, bootstrap JavaScript, HTML, Ajax, Browser: Google Chrome IE8, Opera Mozilla Software: WAMP/ XAMPP/ LAMP/MAMP 7. Open PHPMyAdmin (http://localhost/phpmyadmin) 7.Run the script http://localhost/Online-Food-Order **Try live demo** : https://haemolysis-stubs.000webhostapp.com/index.php admin: chulindra /Chulin@123 user: chulindra / Chulindra ![Screenshot 2023-07-26 160949](https://github.com/IotchulindraRai/Online-Food-Ordering-System-using-PHP/assets/87846923/9d96e522-6658-4c0d-8851-76f1031a0e7c) ![Screenshot 2023-07-26 160921](https://github.com/IotchulindraRai/Online-Food-Ordering-System-using-PHP/assets/87846923/fef59d48-a64e-445d-ae40-3f44fa4154de) ![Screenshot 2023-07-26 161018](https://github.com/IotchulindraRai/Online-Food-Ordering-System-using-PHP/assets/87846923/a6925a86-ff47-46f4-baf3-ee092c55cde5)
The Online Food Ordering System Project, this system can be defined as software web application that allows to accept order placed over the online for hungry customers to view the food restaurant. we can see the Restaurant in a Map in a page.functionof admin /manager and customer where there is a function of CRUD based on responsibility.
javascript,mysql-database,php
2023-07-26T10:53:12Z
2023-08-26T05:49:55Z
null
1
0
5
0
0
2
null
null
PHP
merndev1101/reactjs_eccommerce
main
# Getting Started with Create React App This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). ## Available Scripts In the project directory, you can run: ### `npm start` Runs the app in the development mode.\ Open [http://localhost:3000](http://localhost:3000) to view it in your browser. The page will reload when you make changes.\ You may also see any lint errors in the console. ### `npm test` Launches the test runner in the interactive watch mode.\ See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. ### `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](https://facebook.github.io/create-react-app/docs/deployment) for more information. ### `npm run eject` **Note: this is a one-way operation. Once you `eject`, you can't go back!** If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. ## Learn More You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). To learn React, check out the [React documentation](https://reactjs.org/). ### Code Splitting This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) ### Analyzing the Bundle Size This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) ### Making a Progressive Web App This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) ### Advanced Configuration This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) ### Deployment This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) ### `npm run build` fails to minify This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
This is an ecommerce project which developed with react.js, redux and tailwindcss.
eccomerce,eccommercewebsite,javascript,reactjs,redux,tailwindcss
2023-08-02T11:49:46Z
2023-08-02T12:19:41Z
null
1
0
2
0
0
2
null
null
JavaScript
huzgrx/react_native_shop_app
main
# Shop App </br> <p align="center"> <img width="300" height="600" style = "border-radius: 30px; margin-right: 20px" src="https://i.ibb.co/yfRjyNS/Screenshot-20210728-181451-Shopping-1.jpg"> <img width="300" height="600" style = "border-radius: 30px;" src="https://i.ibb.co/7r0g8MZ/Screenshot-20210728-181502-Shopping-1.jpg"> </p> </br> ## Description This project is a simplified implementation of a shopping system, the project aims to provide the basic features that are expected to be found in a mobile e-commerce application where users can purchase and sell products. To navigate through the app, users have to authenticate themselves. Once logged-in, users can scroll through the list of available products, add different products to the cart, and make orders. Users can also add, edit, remove their own products into the main store. ## Authentication and Security The app contains a simple authentication system implemented using [Firebase Auth REST API](https://firebase.google.com/docs/reference/rest/auth) for the backend. If the authentication process is successful, a unique token is sent from the backend to the user in concern, the token is then stored locally in the device and will expire exactly after 1h of its receival. When expired, the token is deleted from the device and the user will be automatically signed out and prompt to the login screen. Otherwise, if something went wrong with authentication process, the proper error message will be displayed in the screen. To ensure the right credentials are to be provided whenever the user enters some data, all forms in this project contain some basic validation algorithms that are reused whenever validation is required. ## Databases Most data in this project (products, orders, users) is stored in [Firebase Realtime Database](https://firebase.google.com/docs/database). Some other user-specific data (auth-token, favorite products) are stored locally in the device using [AsyncStorage](https://github.com/react-native-async-storage/async-storage). ## Navigation All navigation in this project is built with [React Navigation v5](https://reactnavigation.org/docs/getting-started/). ## Animations The app contains different types of animations on different screens to provide a smoother user experience, all animations are implemented using the [React Native Reanimated](https://docs.swmansion.com/react-native-reanimated/) library, which means the vast majority of calculations required to animate different style properties are all done in the UI Thread in the native side, so the bridge between native and react native is very infrequently crossed, therefore, animtions are never interrupted even if the JS Thread is heavily busy, resulting in smooth animations that would run at 60fps even in low-end devices. ## Designs All design assets used in this app (screens, components, icons...) are made by the owner of this project. ## Usage To run the project locally run the following commands in order: Clone the project locally $ git clone https://github.com/abdoutech19/shop-app.git Navigate to project root directory $ cd shop-app Install all dependencies $ yarn install || npm install Run the project in debug mode $ npx react-native run-android Or run the project in release mode for a smoother experience $ npx react-native run-android --variant=release ***NOTE:** this project uses the [Hermes](https://reactnative.dev/docs/hermes) JavaScript engine to improve start-up time, decrease memory usage, and reduce app size. For these improvments to take effect, the app has to be running in *release* mode, otherwise, Hermes won't have any effect on improving performance in *debug* mode, in fact, some developeres have noticed slower results with the Hermes engine enabled in *debug* mode.* ## Built with - [React Native v0.64](https://reactnative.dev/docs/getting-started) - [React Navigation v5](https://reactnavigation.org/docs/getting-started/) - [Firebase Auth](https://firebase.google.com/docs/reference/rest/auth) - [Firebase Realtime Database](https://firebase.google.com/docs/database) - [React Native Reanimated v2](https://docs.swmansion.com/react-native-reanimated/) ## Demo To test the app in your android device, you can download the **.apk** file from here: [shopping](https://drive.google.com/file/d/1QzceGiaLU72TZSFnQF_250pXH2KnCQHX/view?usp=sharing). ## Video Demo ### Authentication and validation https://user-images.githubusercontent.com/44240293/127367181-ba188c22-997d-4280-8cff-b7867ebf324c.mp4 ### Shopping https://user-images.githubusercontent.com/44240293/127366818-a3f6316b-e770-4a8e-8cd0-59c08df8361d.mp4 ## License Distributed under the MIT License. See LICENSE for more information.
About A shopping mobile application made with react native for Android.
javascript,react-native,shopping-app
2023-07-28T16:35:24Z
2023-07-28T16:41:28Z
null
1
0
18
0
0
2
null
MIT
JavaScript
ankitjha2603/create-element-on-grid
main
null
This project utilizes Three.js to build an interactive 3D grid environment. Users can generate and delete objects on the grid by clicking. Objects rotate, and the camera perspective is adjustable. It's a dynamic, visually engaging experience.
3d-website,canvas,grid,javascript,threejs,visualization,mouse-events,css3,html5
2023-08-08T21:18:02Z
2023-08-08T21:23:10Z
null
1
0
2
0
0
2
null
null
JavaScript
shaik11r/interview_backend
master
# Interview Questions App ## Project Overview This repository hosts the codebase for the Interview Questions App, a full-stack web application developed to help users prepare for interviews in the fields of React, Node.js, Java, and JavaScript. The app offers a user-friendly interface for browsing, searching, and practicing interview questions specific to these technologies. ### Key Features - User authentication and authorization using JWT (JSON Web Tokens) for secure access. - Categorized interview questions for React, Node.js, Java, and JavaScript. - CRUD (Create, Read, Update, Delete) operations for each question, following the MVC (Model-View-Controller) architecture. - A responsive design for optimal usability across devices. - Backend API built with Node.js, Express.js, and MongoDB. - Frontend developed using React for a modern and intuitive user interface. ## Technologies Used - **Frontend:** - React - HTML/CSS - JavaScript - Responsive design for mobile and desktop views. - **Backend:** - Node.js - Express.js - MongoDB for storing interview questions and user data. - JWT (JSON Web Tokens) for authentication and authorization. - MVC architecture for structured and maintainable code.
null
expressjs,javascript,nodejs,react,restapi
2023-07-24T06:28:50Z
2023-12-06T08:57:48Z
null
1
0
31
1
0
2
null
null
JavaScript
Ninja-Talon/4-Colors
main
<a href="#"><img align="center" src="images/logo.png" alt="4 Colors"> # Installation 1. Navigate to the latest release (<a href="https://github.com/Ninja-Talon/4-Colors/releases/tag/v1.0.0">**v1.0.0**</a>) and `install the Source Code (zip)` 2. Once downloaded on your personal device, `unzip the file`. * The software will be in a folder with the same name as the repository. * You can delete the remaining zipped file, as it will no longer be needed! 3. To view and interact with the program, you can `run it in a text editor, host, or a JavaScript IDE`. * <ins>View on AppLab (Code.Org):</ins> * As simple as clicking <a href="https://studio.code.org/projects/applab/6491vxRV76A15gOGMwrlkxDaAAtk8pRNnfbaYpzAG0Y">**here**</a>! * <ins>To do so on Visual Studio Code IDE</ins>: * Launch Visual Studio Code and open the folder (4-Colors-1.0.0) * Install the <a href="https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer">**Live Server**</a> extension if you do not already own it, select Enable, this may require you to restart VSC. * Return to the "EXPLORER" view of the folder (main page) * Select 'Go Live' to host (Bottom Left Corner on Default Settings) * A locally hosted site will be prompted to you, you can now view the project! Any use of the software outside of the AppLab dependency or external from the code.org site *may not* function as intended. For best interaction experience, view it <a href="https://studio.code.org/projects/applab/6491vxRV76A15gOGMwrlkxDaAAtk8pRNnfbaYpzAG0Y">**here**</a>. # * `applab/applab.js` - This file contains the applab library, which has all the javascript that applab uses to run the app. * `applab/applab.css` - This file contains some default CSS styling for the app. * `index.html` - The primary HTML file, it contains all the buttons, text inputs, and other controls for the app. * `style.css` - This file defines the custom styling for each control in the app. It contains all the colors, positions, dimensions, and other properties of the app's controls. * `code.js` - This Javascript file has all the code that makes the app function. * `assets` - This is a directory with all the asset files - pictures and sounds. * `images` - contains imagery for strict github showcase (not used in software) # Regarding AP Exam Terms and Conditions This project was untilized as a submission for a College Board class *(AP Computer Science Principles)* * **<ins>As per exam rules follow on Discussing Exam Questions:</ins>** *free-response content that is not released on the College Board website 2 days after the regularly scheduled exam administration* is **NOT** allowed, **HOWEVER** *If the free-response content on your AP Exam is posted to the College Board website two days after the regularly scheduled exam, you may discuss it at that point.* This serves true to the AP Computer Science 2023 Exam, with publically posted Student Samples including the questions. * **This public github repository is <ins>NOT</ins> being shared to deliberately gain or attempt to gain, or to share an unfair advantage on any College Board test, nor is it threatening the integrity of the test itself.** The files contained in this project are <ins>licensed under a BSD 3-Clause</ins> stating that any redistribution <ins>**MUST**</ins> retain the copyright notice <ins>**AND**</ins> that any redistributions, in whole or in part, of the software, shall not be permitted for the use of an AP College Class Submission or the Digital Portfolio (collegeboard.org). The software, artistic works, and computer code are all protected under my Creative IP, and are not owned by College Board. # For a detailed view on the application, or to use my work as an APCSP Student Sample Reference, feel free to checkout my Exam Written Responses <a href="https://github.com/Ninja-Talon/4-Colors/blob/main/images/writtenResponses.pdf">**here**</a>!
4 Colors: A fast-paced strategy card game! Discard your deck before the clock runs out. Match colors, numbers, and use special power cards. Unique gameplay rules and card cycling with arrows. Outwit your opponents and claim victory!
applab,cards,game,indie,javascript,singleplayer,apcsp,uno
2023-07-25T02:57:23Z
2023-07-25T06:45:47Z
2023-07-25T05:51:55Z
1
0
28
0
0
2
null
NOASSERTION
CSS
MrSn0wy/fpps4.net
main
# fpps4.net >If you are searching for [fpPS4](https://github.com/red-prig/fpPS4) or the [fpPS4 compatibility list](https://github.com/red-prig/fpps4-game-compatibility) you can visit them be clicking on the links <hr> ## The offical repositoy for [fpps4.net](https://fpps4.net) This is the offcial source code for [fpps4.net](https://fpps4.net). <br> Any changes will be published to this repository to keep it up to date with the website. <br>
The official website for the open-source compatibility layer fpPS4.
css,fpps4,html,javascript,php,ps4,website,playstation4
2023-08-03T19:17:45Z
2023-11-25T19:10:29Z
null
1
0
17
0
0
2
null
GPL-2.0
HTML
99dino/chess-ai
master
# Chess-AI [Live_demo](https://99dino.github.io/chess-ai/) Inspired by N-queen ( standard backtrack problem ), Let me present Chess-engine that follow the backtrack alogrithm plus some optimization methods. ![CHESS_UI](img/CHESS_UI.png) ## About Chess-AI Chess-AI is a simple chess AI in JavaScript. The primary concern of chess-ai is the decision-making part of the application. All functionality outside the scope of the AI are implemented using external libraries: - Chessboard GUI: Using the chessboard.js library - Game Mechanics: Using the chess.js library The AI uses the minimax algorithm, which is optimised by alpha-beta pruning. The evaluation function uses piece square tables adapted from Sunfish.py, and eliminates the need for nested loops by updating the sum based on each move instead of re-computing the sum of individual pieces at each leaf node. A global sum is used to keep track of black's evaluation score after each move, which is used to display the 'advantage' bar.
Chess Algorithm using minimax backtrack algorithm , optimised by alpha beta pruning... Involves chess.js and chessboard.js library to govern game mechanics and chessboard GUI
bootstrap5,chess-ai,css3,html5,javascript,jquery,minimax-alpha-beta-pruning
2023-07-30T06:53:47Z
2023-08-02T05:32:38Z
null
1
0
41
1
0
2
null
null
JavaScript
codx-ak/Register-Form-React
main
null
The simple signup form in React enables effortless user registration by capturing essential information through an intuitive, responsive interface. Utilizing React components and form handling, it enhances user engagement and data collection seamlessly.
codx,codx-ak,javascript,material-ui,react,reactjs,signup-form,signup-page
2023-07-21T09:13:46Z
2023-10-11T12:29:17Z
null
1
0
5
0
1
2
null
null
JavaScript
Raghav-995/DrivingSchoolSite
main
# DrivingSchoolSite Directly open Index.html by double clicking in it. This site is built by using HTML,CSS,JS. ![Screenshot (67)](https://github.com/Raghav-995/DrivingSchoolSite/assets/139675343/f6540e39-d93c-42db-9d2f-94806ade0c9a)
HTML and CSS is used to design a site.
css,html,javascript
2023-07-27T15:43:43Z
2023-08-03T12:53:33Z
null
1
0
3
0
0
2
null
null
HTML
abdullah-ayyash/eShopify-Online-Store
main
# ShopNex - Your Next-Gen Online Store Web App (PERN Stack) Welcome to ShopNex, a cutting-edge online store web application built using the PERN (PostgreSQL, Express.js, React.js, Node.js) stack. ShopNex aims to provide an exceptional shopping experience for customers while offering a seamless platform for merchants to manage their online businesses. Whether you're a small boutique owner or an aspiring entrepreneur, ShopNex equips you with the tools needed to succeed in the competitive e-commerce landscape. ## Key Features - **Dynamic and Interactive Frontend:** Enjoy a smooth and engaging shopping experience with our dynamic React.js-based user interface. - **Secure User Authentication:** ShopNex prioritizes security with robust user authentication mechanisms for both customers and merchants. - **Effortless Product Management:** As a merchant, easily manage your product catalog, organize products into categories, and monitor inventory levels. - **Real-time Shopping Cart:** Customer shopping carts update in real-time, ensuring a seamless and dynamic shopping experience. - **Order Tracking and History:** Customers can easily track the status of their orders and access their order history. ## Tech Stack - **Frontend:** React.js, HTML, CSS - **Backend:** Node.js, Express.js - **Database:** PostgreSQL - **Payment Integration:** Credit Card ## Getting Started To run ShopNex locally, follow these steps: 1. Clone the repository: ```javascript git clone https://github.com/abdullah-ayyash/eShopify-Online-Store.git cd shopnex ``` 2. Install dependencies for the frontend and backend: ```javascript cd frontend npm install cd ../backend npm install ``` 3. Configure the environment variables: Create a `.env` file in the `backend` directory and add the required environment variables for your database connection and payment gateway API keys. 4. Set up the database: Ensure you have PostgreSQL installed and create a database for ShopNex. Then, run the database migrations: ```javascript cd backend npx knex migrate:latest ``` 5. Start the development servers: ```javascript cd frontend npm start cd ../backend npm start ``` 6. Visit `http://localhost:3000` in your web browser to access the ShopNex application. ## Deployment To deploy ShopNex to a production environment, follow the deployment instructions specific to your chosen hosting platform (AWS, Heroku, etc.). Remember to set the appropriate environment variables for the production environment. ## Contribution We welcome contributions from the open-source community. If you find any issues or want to suggest enhancements, please create a pull request or open an issue in the GitHub repository. ## License This project is licensed under the [MIT License](LICENSE). Feel free to use, modify, and distribute the code as per the terms of this license. --- Thank you for choosing ShopNex! We hope our online store web application enhances your business and delights your customers. If you have any questions or need assistance, please don't hesitate to reach out. Happy selling!
ShopNex is a state-of-the-art online store web application, powered by the PERN (PostgreSQL, Express.js, React.js, Node.js) stack, designed to deliver an exceptional shopping experience for customers and provide a seamless platform for merchants to manage their online businesses.
css,express,expressjs,html,javascript,node,nodejs,pern,pern-stack,postgres
2023-07-29T07:46:48Z
2023-09-23T06:02:32Z
null
1
0
106
0
1
2
null
MIT
JavaScript
Vijay093/Portfolio
main
null
null
bootstrap5,css,html,javascript,portfolio-website
2023-08-06T14:30:26Z
2023-08-14T14:27:44Z
null
1
0
12
0
0
2
null
null
HTML
Happyuky7/Draggable-Cards-in-web
master
# Draggable-Cards-in-web Draggable-Cards-in-web is a simple Script Draggable Cards + Website for example using and implementing. ## License - [View License](https://github.com/Happyuky7/Draggable-Cards-in-web/tree/master/LICENSE) ## Using the Draggable Cards Using in very easy configurations ```js // Script: // Github: https://github.com/Happyuky7/Draggable-Cards-in-web/edit/master/js/script.js document.addEventListener('DOMContentLoaded', async () => { // Start Configuration // Configure the script // If is true then the script is in debug mode. let debug = false; // If is true then button clear storage is enabled in web. let clearbtnbolean = true; // value is the Clear LocalStorage button, // Required: clearbtnboolean is set to true and configuration // button clear in html code. const valueClearBtn = 'clear-storage-btn' // The following values MUST be set for this script to work on your web site. // valueCardContainer is the class of the container of the cards. const valueCardContainer = '.card-container' // valueCard is the class of the cards. const valueCard = '.card' // IMPORTANT: // valueTargetCard is the class of the cards. // valueTargetCard is the same as valueCard, // the only difference is that valueTargetCard does not have "." and valueCard does. // **IMPORTANT** without this the Script **DOES NOT WORK**. const valueTargetCard = 'card' // valueDataOrder is the data attribute of the cards that stores the order. // Value solo used Internal in this script OR LocalStorage variable. const valueDataOrder = 'data-order' // valueDataID is the data attribute of the cards that stores the id. const valueDataID = 'data-id' // valueCardOrderMap is the LocalStorage variable that stores the order of // the cards. const valueCardOrderMap = 'cardOrderMap' // End Required values MUST be set for this script to work. // If is true then the script is in debug mode. if (debug === true) { console.log('Debug mode enabled'); if (clearbtnbolean === true) { console.log('Clear LocalStorage button enabled'); console.log('valueClearBtn: ' + valueClearBtn); } console.log('Clear LocalStorage button disabled'); console.log('valueCardContainer: ' + valueCardContainer); console.log('valueCard: ' + valueCard); console.log('valueDataOrder: ' + valueDataOrder); console.log('valueDataID: ' + valueDataID); console.log('valueCardOrderMap: ' + valueCardOrderMap); } // End Configuration // Start Script Code const cardContainer = document.querySelector(valueCardContainer); let draggedCard = null; // Function for storing the positions and contents of cards in the LocalStorage function saveCardData() { const cards = document.querySelectorAll(valueCard); cards.forEach((card, index) => { card.setAttribute(valueDataOrder, index + 1); }); const cardOrderMap = {}; cards.forEach((card) => { const cardId = card.getAttribute(valueDataID); const cardOrder = card.getAttribute(valueDataOrder); cardOrderMap[cardId] = parseInt(cardOrder); }); localStorage.setItem(valueCardOrderMap, JSON.stringify(cardOrderMap)); console.log('[SAVE] Card order saved in the LocalStorage.'); } // Function for loading positions and stored content and positioning cards async function loadCardData() { return new Promise((resolve) => { const cardOrderMap = JSON.parse(localStorage.getItem(valueCardOrderMap)); if (cardOrderMap) { const cards = document.querySelectorAll(valueCard); const sortedCards = [...cards].sort((a, b) => { const cardIdA = a.getAttribute(valueDataID); const cardIdB = b.getAttribute(valueDataID); return cardOrderMap[cardIdA] - cardOrderMap[cardIdB]; }); // ADD card in correct order. sortedCards.forEach((card, index) => { cardContainer.appendChild(card); const cardId = card.getAttribute(valueDataID); cardOrderMap[cardId] = index + 1; }); // Delete the card, not exist in the DOM. const existingCardIds = Array.from(cards).map((card) => card.getAttribute(valueDataID)); const storedCardIds = Object.keys(cardOrderMap); const removedCardIds = storedCardIds.filter((id) => !existingCardIds.includes(id)); removedCardIds.forEach((removedId) => { delete cardOrderMap[removedId]; }); // Save for changes in LocalStorage. localStorage.setItem(valueCardOrderMap, JSON.stringify(cardOrderMap)); console.log('New card order:'); sortedCards.forEach((card, index) => { console.log(`${index + 1} = ${card.getAttribute(valueDataID)}`); }); } console.log('[LOAD] Card order loaded from LocalStorage.'); resolve(); }); } // Events of the Cards Order: // Save card position. cardContainer.addEventListener('dragend', () => { saveCardData(); }); // Start move card position. cardContainer.addEventListener('dragstart', (e) => { draggedCard = e.target; }); // Check move area card position and save new position. cardContainer.addEventListener('dragover', (e) => { e.preventDefault(); const targetCard = e.target; if (targetCard !== draggedCard && targetCard.classList.contains(valueTargetCard)) { const targetRect = targetCard.getBoundingClientRect(); const draggedRect = draggedCard.getBoundingClientRect(); if (e.clientY - targetRect.top < targetRect.height / 2) { cardContainer.insertBefore(draggedCard, targetCard); } else { cardContainer.insertBefore(draggedCard, targetCard.nextSibling); } console.log('New card order:'); const cards = document.querySelectorAll(valueCard); cards.forEach((card, index) => { console.log(`${index + 1} = ${card.getAttribute(valueDataID)}`); }); saveCardData(); } }); // If is true then button clear storage is enabled in web. // REQUIRES // 1. Add in HTML the button with id="clear-storage-btn" OR // your id set in valueClearBtn variable. if (clearbtnbolean === true) { // Clear LocalStorage const clearStorageBtn = document.getElementById(valueClearBtn); clearStorageBtn.addEventListener('click', () => { localStorage.clear(); loadCardData().then(() => { console.log('LocalStorage deleted and card positions reset.'); window.location.reload(); }); }); } // Load card position. await loadCardData(); }); ``` In html view [index.html | Click here](https://github.com/Happyuky7/Draggable-Cards-in-web/tree/master/index.html) --- ## Aditional Information [My website](https://happyrogelio7.xyz), My website [Discord](https://discord.gg/3EebYUyeUX), Support My Server Discord [Kaory Studios](https://kaorystudios.xyz), Website Kaory Studios [Kaory Studios Discord](https://discord.gg/Gw7m8kC), Support Kaory Studios --- © Copyright HappyRogelio7 2017-2023 © RIGHTS RESERVED ## Special Thanks - **Visual Studio Code**: [Link](https://code.visualstudio.com/) ![Visual Studio Code Logo](./statics/imgs/vscode.png) - Description: Visual Studio Code is a lightweight and powerful source code editor that provides excellent support for various programming languages, debugging, and version control integration. Happy coding!
Draggable-Cards-in-web is a simple Script Draggable Cards + Website for example using and implementing.
card,draggable,draggable-elements,draggable-panel,js,web,website,javascript,nodejs
2023-07-25T04:31:15Z
2023-12-14T06:10:44Z
2023-07-25T04:40:09Z
1
0
7
0
0
2
null
MIT
JavaScript
WaxenOsprey/Gwentish
main
# Gwentish! - A Browser Card Game App **Gwentish** is a browser-based card game app based on the popular card game Gwent from the Witcher series. The app will allow players to register and log in to play the game, and will feature a deck-building feature where players can customize their card decks. The game will be turn-based, with rules based on Gwent, including drawing cards at the beginning of the game, playing cards with abilities and power values, taking turns and playing cards strategically, and determining the winner based on card power. The app will also feature a visual display of player's lives and scores, and will integrate with the backend to handle game logic and rules. ## Screenshots <div style="text-align: center"> <span> <kbd> <img height="200px" alt="Portfolio page" src="./client/src/screenshots/title.png"> </kbd> &emsp;&emsp; <kbd> <img height="200px" alt="Stock page" src="./client/src/screenshots/action.png"> </kbd> <span> </div> <hr> ## Demo Video [Watch the Demo Video](https://youtu.be/UtxtS1FAiGI?si=0TUAN--aWV-vA7Y4) ## Built with: - PostgreSQL - Spring - Java - JavaScript - React.js - <a href="https://api.gwent.one/"> GwentOne API </a> <hr> <span> <img hspace="5" height="50px" title="PostgreSQL" src="https://github.com/devicons/devicon/blob/master/icons/postgresql/postgresql-original.svg"> <img hspace="5" height="50px" title="Spring" src="https://github.com/devicons/devicon/blob/master/icons/spring/spring-original.svg"> <img hspace="5" height="50px" title="Java" src="https://github.com/devicons/devicon/blob/master/icons/java/java-original.svg"> <img hspace="5" height="50px" title="JavaScript" src="https://raw.githubusercontent.com/devicons/devicon/v2.15.1/icons/javascript/javascript-original.svg"> <img hspace="5" height="50px" title="React JS" src="https://raw.githubusercontent.com/devicons/devicon/v2.15.1/icons/react/react-original.svg"> <img hspace="5" height="50px" title="GwentOne API" src="https://gwent.one/image/favicon/favicon-96x96.png"> </span> <hr> ## Getting Started ### Prerequisites - Java 11 - Maven - PostgreSQL ### Installation 1. Clone the repo ```sh git clone ``` 2. Install NPM packages ```sh npm install ``` 3. Install Maven packages ```sh mvn install ``` 4. Create a PostgreSQL database called `gwentish` ```sh createdb gwentish ``` 5. Run the Spring server ```sh mvn spring-boot:run ``` 6. Run the React app ```sh npm start ``` 7. Open the app in your browser at `http://localhost:3000/` <hr> ## Brief Create a browser-based Gwent card game app that replicates the key features and gameplay mechanics of the original game. ## MVP - Turn-based gameplay with rules based on Gwent, including: - Implement rarity levels for cards, affecting their power or special abilities - Drawing cards at the beginning of the game - Playing cards with abilities and power values - Taking turns and playing cards strategically - Determining the winner based on card power - A visual display of player's lives and scores - Integration with the backend to handle game logic and rules - A feature for players to register and log in to the game - A deck-building feature where players can create and customize their card decks ## EXTENSIONS - Implement different factions with unique abilities and card sets - Include an AI opponent for single-player mode - Implement a leaderboard to track player rankings and scores ## Thanks to: <a href="https://github.com/Greghi2000"> Gregorio Fumagalli </a>for his assistance during the early stages of the project.
Inspired by Gwent, the well-known mini-game from the iconic Witcher franchise, Gwentish is a turn-based card game brought to life as a standalone web application. Developed using Java, Spring, JavaScript, React, and MongoDB technologies.
gwent-cards,java,javascript,mongodb,react,spring-boot,witcher
2023-08-08T15:46:03Z
2023-10-01T17:27:10Z
null
1
0
29
0
0
2
null
null
Java
AkshandraSingh/motivationReminder
main
# Motivational Email Sender - A Full Stack Project Motivational Email Sender is a web application that delivers inspirational and motivational messages to users via email. This Full Stack Project combines HTML, CSS, and Node.js to provide a seamless user experience. Spread positivity and uplift others by trying out the Motivational Email Sender! ## Table of Contents - [Introduction](#introduction) - [Features](#features) - [Technology Stack](#technology-stack) - [How to Use](#how-to-use) ## Introduction The Motivational Email Sender web application allows users to receive encouraging messages right in their inbox. Whether you need a dose of motivation or want to brighten someone else's day, this app is the perfect tool. Just visit the app, enter your email address, and enjoy a steady stream of uplifting quotes and lines. ## Features - Simple and intuitive user interface - Quick and easy email By Clik on Button - Backend powered by Node.js to handle email sending - Secure data management for user privacy - An inspiring collection of motivational lines ## Technology Stack - Frontend: HTML, CSS - Backend: Node.js - External Libraries/APIs: [express,nodemailer,dotenv,axios,body-parse and nodemon] ## How to Use 1. Enter your email address 2. Click on Send Mail 3. Keep an eye on your inbox for motivational messages!
Motivational Email Sender is a Full Stack Project utilizing HTML, CSS, and Node.js. The project's purpose is to spread positivity by sending motivational lines to users via email. Users can visit the web application, input their email address, and receive uplifting messages in their inbox. The email-sending functionality is handled by Node.js
axios,css,html5,javascript,nodejs,nodemailer,nodemon,rou
2023-07-30T15:23:43Z
2023-07-30T15:47:57Z
null
1
0
5
0
0
2
null
null
HTML
AnshSinghSonkhia/syncshift-code
main
null
null
css,html,javascript,tailwindcss
2023-08-02T13:38:26Z
2023-08-02T13:45:26Z
null
2
0
7
0
0
2
null
null
HTML
loweffort-alt/ToDoLock-server
main
# Welcome to ToDoLock Server! 👺 This server has a simple logic to avoid space problems in my database. It can store a total of 10 users with a maximum of 10 notes per user. In other words, the 11th user will erase all data from the 1st user and so on. ![arraygif](https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExMzk5em1sbTkzemdmbGhtbDNhZWFvdDhyNnllenN1bTg5ZHRub24xYSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/AJKtYQdsPoRfS8rxgt/source.gif) **ENG:** Here's a visual guide to understanding how a REST API works, specifically the flow of execution of a web page server. If you have any advice to improve the diagram, write it as a comment. **ESP:** Guía visual para comprender cómo funciona una API REST, específicamente el flujo de ejecución de un servidor de páginas web. Si tienes algún consejo para mejorar el diagrama, escríbelo como comentario. ## Check the [diagram in Figma](https://www.figma.com/community/file/1275291490973723744/REST-API-Diagram-ENG%2FESP)
Visual explanation how to works fullstack simple todo web app
auth,crud,docker,figma,javascript,mongodb,nodejs,react,api,diagram
2023-07-26T09:09:46Z
2024-03-04T07:52:27Z
null
1
3
47
0
0
2
null
null
JavaScript
chrisrobison/invoice
main
# CR Invoice CR Invoice is a simple, lightweight (no external libraries), browser-based invoice creator app. This web-based tool allows the creation of ad-hoc or one-off invoices that look clean and professional. The invoices you make can be saved with all data stored locally using web storage technologies; your information is never shared or sent over the network. Your data can be imported and exported, giving you the freedom to keep your data anywhere you'd like. Output formats: PDF, HTML ## Usage 1. Clone repo and load index.html page or go to [CR Invoice](https://cdr2.com/invoice/) in your web browser. 2. Toolbar at top provides buttons to perform the following actions: - New - Creates new invoice - Save - Saves current invoice - Delete - Deletes current invoice upon confirmation - Import - Import invoices - Export - Export all invoices - Print - Print current invoice - Help - Opens help dialog 3. Dropdown below toolbar lists saved invoices. Select one to load. 4. Nearly everything is editable outside of the page layout.
Simple, light-weight, totally self-contained, no external libraries, client-side invoice creator with all data stored locally in-browser.
invoice,invoice-generator,invoice-management,javascript,pdf,zero-dependency
2023-08-04T05:57:53Z
2024-04-09T22:55:12Z
null
1
0
23
0
0
2
null
MIT
CSS
stamat/book-of-spells
main
# 📖 Stamat's Book of JavaScript Spells [![npm version](https://img.shields.io/npm/v/book-of-spells)](https://www.npmjs.com/package/book-of-spells) [![license mit](https://img.shields.io/badge/license-MIT-green)](https://github.com/stamat/book-of-spells/blob/main/LICENSE) A collection of JavaScript functions and snippets that I use in my projects in **ESM format**. This is mainly for my own reference, but I hope it can be useful to others as well. > The problem, Bernard, is that what you and I do is so complicated. We practice witchcraft. We speak the right words. Then we create life itself… out of chaos. - Dr. Robert Ford, Westworld S01E02 ## Installation ```bash npm i book-of-spells ``` ## Usage [📖 Documentation](https://stamat.github.io/book-of-spells/) ```js import { clone } from 'book-of-spells' // if your bundler doesn't resolve npm packages use the full path: import { clone } from './node_modules/book-of-spells/index.mjs' const a = { a: 1, b: 2, c: { d: 3, e: 4} } const b = clone(a) console.log( a.c === b.c ) // false ``` ## Why After 14+ years of JavaScript and copy-pasting my own undocumented code, I've decided to start documenting it. I'm not sure why I didn't do it sooner. Actually, I'm lying, I do know why. I am so lazy that I'd rather copy or write the same code over and over again than document it - which is, of course, much more work than keeping and maintaining it in one place and distributing it as a package. It's not only laziness, if you think about it. It is this omnipresent fear of change, of the unknown, of the new. But change is good. Being unconformable is good. It means you're growing. It means you're learning. It means you're alive. ## Contributing If you have a function or a snippet that you think is useful, please open a PR. I'd love to see what you've got. ---- With love 💖, Stamat
📖 Stamat's Book of JavaScript Spells
javascript,utility-library
2023-07-24T12:48:15Z
2024-04-28T09:23:13Z
2024-04-28T09:23:13Z
1
0
191
1
0
2
null
MIT
JavaScript
qiuxchao/yapi-ai-mock
main
# yapi-ai-mock <br> <br> <p align="center"> <b>使用 LLM,将 YAPI 接口文档生成为本地的 Mock 文件。</b> </p> <p align="center">对 Vite 和 Webpack 项目提供 Mock 插件/中间件,其他项目可使用独立部署的 Mock 服务。</p> <br> <p align="center"> <a href="https://www.npmjs.com/package/yapi-ai-mock"><img alt="npm" src="https://img.shields.io/npm/v/yapi-ai-mock?style=flat-square"></a> <img alt="node-current" src="https://img.shields.io/node/v/yapi-ai-mock?style=flat-square"> <img alt="npm" src="https://img.shields.io/npm/dt/yapi-ai-mock?style=flat-square"> <br> </p> <br> <br> ## 特性 - 🛠️ 支持自定义 LLM 和 Prompt - 🌐 支持 YAPI 多服务器、多项目、多分类 - 🤖 支持预处理接口信息 - 📝 完整的注释 - 🧱 支持自定义生成的代码块 - 🦾 支持生成 Typescript/JavaScript 代码 - 💡 支持 ESModule - 🪝 支持生成流程的 Hooks - 🧲 非注入式,对客户端代码无侵入 - 🔥 支持 Mock 文件热更新 - 📦 自动加载 Mock 文件 - ⚙️ 随意开启或关闭对某个接口的 Mock 配置 - 🗂 支持构建可独立部署的小型 Mock 服务 ## 安装 ```bash # npm npm i yapi-ai-mock mockjs @types/mockjs -D # yarn yarn add yapi-ai-mock mockjs @types/mockjs -D # pnpm pnpm add yapi-ai-mock mockjs @types/mockjs -D ``` ## 使用 1. 初始化配置文件: ```bash # 生成默认的 ts 配置文件 npx yam init # 生成 js 配置文件 npx yam init -t=js ``` 2. 生成配置文件后,在配置文件中填写 YAPI 服务器相关配置和 LLM 相关配置,以及其他[配置项](#配置)。 3. 运行命令,生成 mock 文件: ```bash npx yam ``` 4. 在项目中使用 mock 文件: - vite 或 webpack 项目,使用 mock [插件/中间件](#mock-插件中间件) - 在其他项目中使用,直接启动 mock 服务器: ```bash npx yam serve ``` 5. 在项目中请求接口时,将接口地址改为 mock 服务器地址,例如: ```ts // 请求地址为 http://api.foo.bar/path/to/api // vite/webpack 项目改为 /mock/path/to/api // 独立启动的 mock 服务改为 http://localhost:3000/mock/path/to/api ``` ## 配置 当执行 `npx yam` 命令生成 mock 文件时,会默认读取当前目录下的 `yam.config.ts` 或 `yam.config.js` 文件,也可以通过 `-c` 参数指定配置文件路径。 在一个新项目中,可以通过 `npx yam init` 命令初始化一个配置文件,也可以手动创建配置文件。 配置文件示例: ```ts // yam.config.ts import { defineConfig } from 'yapi-ai-mock'; export default defineConfig({ yapi: { // yapi 服务地址。 serverUrl: 'http://yapi.foo.bar', // 项目列表 projects: [ { // 项目的唯一标识。支持多个项目。 token: 'xxx', // 分类列表。 categories: [ { id: [0], }, ], }, ], }, }); ``` ### `yapi` YAPI 服务相关配置。 可以配置为一个列表,用于同时生成多个 YAPI 服务的接口。 #### 公共配置 - 类型: ````ts /** * 共享的配置。 */ export interface SharedConfig { /** * 要生成的目标代码类型。 * 默认为 `typescript`。 * * 设置为 `javascript` 时,将会根据当前项目的 `package.json` 中的 `type` 字段来决定生成文件的后缀名,如果 `type` 为 `module`,则生成 `.js` 后缀名,否则生成 `.mjs` 后缀名。 * * @default 'typescript' */ target?: 'javascript' | 'typescript'; /** * 支持生成注释的相关配置。 */ comment?: CommentConfig; /** * 预处理接口信息,返回新的接口信息。可返回 false 排除当前接口。 * * 譬如你想对接口的 `path` 进行某些处理或者想排除某些接口,就可使用该方法。 * * @param interfaceInfo 接口信息 * @param changeCase 常用的大小写转换函数集合对象 * @param syntheticalConfig 作用到当前接口的最终配置 * @example * * ```js * interfaceInfo => { * interfaceInfo.path = interfaceInfo.path.replace('v1', 'v2') * return interfaceInfo * } * ``` */ preproccessInterface?( interfaceInfo: Interface, changeCase: ChangeCase, syntheticalConfig: SyntheticalConfig, ): Interface | false; } ```` 公共配置可以在服务器级别、项目级别、分类级别进行配置,如果存在相同的配置项,低级别的配置会覆盖高级别的配置。 #### `yapi.serverUrl` - 类型:`string` - 默认值:`''` YAPI 服务地址。示例:`http://yapi.foo.bar` #### `yapi.projects` - 类型: ```ts /** * 项目的配置。 */ export interface ProjectConfig extends SharedConfig { /** * 项目的唯一标识。支持多个项目。 * * 获取方式:打开项目 --> `设置` --> `token配置` --> 复制 token。 * * @example 'e02a47135259d0c1973a9ff8xsbb30685d64abc7df39edaa1ac6b6a792a647d' */ token: string | string[]; /** * 分类列表。 */ categories: Array<{ /** * 分类 ID,可以设置多个。设为 `0` 时表示全部分类。 * * 如果需要获取全部分类,同时排除指定分类,可以这样:`[0, -20, -21]`,分类 ID 前面的负号表示排除。 * * 获取方式:打开项目 --> 点开分类 --> 复制浏览器地址栏 `/api/cat_` 后面的数字。 * * @example 20 */ id: number | number[]; }>; } ``` - 默认值:`[]` 项目列表。 ### `envPath` - 类型:`string` - 默认值:`'.env''` 环境变量文件路径。 可以在其中配置 `OPENAI_API_KEY` 等[环境变量](#环境变量)。 ### `mockDir` - 类型:`string` - 默认值:`'mock'` 生成 mock 文件目录路径。 配置改项后,生成的 mock 文件会放在该目录下。 ### `mockPrefix` - 类型:`string` - 默认值:`'/mock'` mock 接口前缀。 生成的 mock 文件中,接口的路径会加上该前缀。 ### `mockSchemaPath` - 类型:`${string}.ts` - 默认值:`'assets/mockSchema.ts'` 给 LLM 的类型提示文件路径。默认为 `yapi-ai-mock/lib/assets/mockSchema.ts`。 如果配置了此项,请确保文件中有 `MockResponse` 和 `ResponseBodyType` 两个类型。 此选项的配置可以参考 [TypeChat Examples](https://github.com/microsoft/TypeChat/tree/main/examples) ### `mockResponseBodyType` - 类型:`string` - 默认值:`'any'` 给 LLM 的期望的 mock 结果的类型定义。 如果配置了 [`mockSchemaPath`](#mockschemapath),则此配置项无效(因为可以在 `mockSchemaPath` 指向的文件中配置 `ResponseBodyType` 类型)。 此配置项会与 `yapi-ai-mock/lib/assets/mockSchema.ts` 进行合并,然后将合并后的结果传输给 LLM。 格式为 typescript 类型字符串。 示例: ```ts `{ // response code (default: 200) code?: 200 | '200'; // response message (default: success) message?: 'success'; // response message data (default: null) // If it has currentPage field, its value is 1 // If there is a field related to the name of the person in the data, it will be simulated as a Chinese name data: any; }`; ``` ### llmTokens - 类型:`number` - 默认值: `4096` LLM 支持的 Tokens 数量,默认为 `4096`。 可以通过调整此配置项来控制每次向 LLM 发送的数据量,但不能超过 LLM 支持的最大 Tokens 数。 ### `createLanguageModel` - 类型: ```ts /** * @param axios axios 方法 * @param success 成功回调 * @param error 失败回调 * @param apiEndpoint api 地址,可通过环境变量 `OPENAI_ENDPOINT` 设置,默认为 `https://api.openai.com/v1/chat/completions` * * @returns [TypeChatLanguageModel](https://github.com/microsoft/TypeChat/blob/main/src/model.ts#L10C28-L10C28) * */ function createLanguageModel: ( axios: AxiosStatic, success: <T>(data: T) => Success<T>, error: (message: string) => Error, apiEndpoint: string, ): TypeChatLanguageModel; ``` 自定义 LLM。如果在[环境变量](#环境变量)中设置了 `OPENAI_API_KEY`,则此配置项无效。(因为会直接使用 openai ChatGPT 的模型) 示例: ```ts { createLanguageModel: (axios, success, error, apiEndpoint) => ({ complete: async prompt => { try { const response = await axios(apiEndpoint, { method: 'POST', headers: { Authorization: `Bearer ${apiKey}`, 'Content-Type': 'application/json', }, data: JSON.stringify({ temperature: 0, n: 1, messages: [{ role: 'user', content: prompt }], }), }); const json = response.data; return success((json?.data?.content as string) ?? ''); } catch (err) { return error(`LLM fetch error: ${err}`); } }, }); } ``` ### `mockServer` - 类型: ```ts /** * mock 服务配置。 */ export interface MockServerConfig { /** * mock 服务端口。默认为 `3000`。 * * @default 3000 */ port?: number; /** * 为 http mock 服务配置 路径匹配规则,任何请求路径以 prefix 开头的都将被拦截代理。 * 如果 prefix 以 `^` 开头,将被识别为 `RegExp`。 * @default '/mock' * @example ['/mock'] */ prefix?: string | string[]; /** * glob字符串匹配 mock数据文件 * * 默认 ['mock/&#42;&#42;&#47;&#42;.&#42;'] */ include?: string | string[]; /** * 自定义要 mock 的接口列表。 * * 该配置项可以用来覆盖生成的 mock 文件,也可以用来 mock 一些没有配置 mock 文件的接口。 * * @example *{ * overwrite: () => [ * { * url: '/mock/userInfo', * method: 'GET', * body: mockjs.mock({code: 200, message: 'success', data: {nickname: '@cname'}}) * }, * ... * ] *} */ overwrite?: () => MockOptionsItem | MockOptionsItem[]; } ``` - 默认值: ```ts { port: 3000, prefix: '/mock', include: ['mock/**/*.*'], overwrite: () => [], } ``` mock 服务配置。 mock 服务是一个 http 服务,用于拦截请求并返回 mock 数据。 当你的项目不是 webpack 或 vite 构建的时,应当使用 mock 服务。 使用 `npx yam serve` 命令启动 mock 服务。 ### `mockStatement` - 类型: ```ts function mockStatement: (mockConstruction: MockConstruction): string; /** mock 代码片段配置 */ export interface MockConstruction { /** 注释 */ comment: string; /** 请求路径 */ path: string; /** 请求方法 */ method: Method; /** LLM 生成的 mock 代码 */ mockCode: string; /** * 接口响应数据 hash 值,将此值注入到生成的代码中,用于判断接口数据是否更新。 * * 注入格式: /* hash: ${mockConstruction.hash} &#42;&#47; */ hash: string; } ``` - 默认值: ```ts ` /* hash: ${mockConstruction.hash} */ ${mockConstruction.comment} export default defineMock({ url: '${config.mockPrefix || '/mock'}${mockConstruction.path}', method: '${mockConstruction.method}', body: mockjs.mock( ${mockConstruction.mockCode || '{}'} ), }); `; ``` 自定义生成的 mock 代码片段。 使用此方法可以自定义生成结果中的 mock 代码片段,如果不设置,则使用默认的 mock 代码片段。 ### `mockImportStatement` - 类型: ```ts function mockImportStatement: (): string ``` - 默认值: ```ts ` import mockjs from 'mockjs'; import { defineMock } from 'yapi-ai-mock'; `; ``` 生成的文件顶部引入部分的代码片段。 ### `processMockResult` - 类型: ```ts /** * @param mockResult LLM 返回的 mock 结果 * @param interfaceInfo 接口信息 * */ function processMockResult: (mockResult: any, interfaceInfo: Interface): void; ``` 自定义的对 LLM 返回的 mock 结果进行处理,使其符合预期。 如果不设置,则直接使用 LLM 返回的 mock 结果。 示例: ```ts { processMockResult: (mockResult, interfaceInfo) => { if (mockResult?.hasOwnProperty('code')) { mockResult.code = 200; } if (mockResult?.hasOwnProperty('message')) { mockResult.message = 'success'; } }; } ``` ## 环境变量 在 [`envPath`](#envpath) 配置项指定的环境变量文件中,可以配置以下环境变量: | 变量名 | 说明 | | --------------------- | ----------------------------------------------------------------------------------------------------- | | `OPENAI_API_KEY` | OpenAI API Key,用于调用 OpenAI 的 ChatGPT 模型。 | | `OPENAI_ENDPOINT` | OpenAI API 地址,用于调用 OpenAI 的 ChatGPT 模型。默认为 `https://api.openai.com/v1/chat/completions` | | `OPENAI_MODEL` | OpenAI 模型名称(例如 `gpt-3.5-turbo` 或 `gpt-4`),配置了 `OPENAI_API_KEY` 时必须配置此变量 | | `OPENAI_ORGANIZATION` | OpenAI 组织 - 可选,默认为 `''` | 如果在环境变量中配置了 `OPENAI_API_KEY`,则 [`createLanguageModel`](#createlanguagemodel) 配置项无效。 ## Mock 插件/中间件 yapi-ai-mock 提供了 vite 和 webpack 的 mock 插件/中间件,其他项目中可以使用 `npx yam serve` 来启动独立部署的 mock 服务。 ### `viteMockPlugin` - 类型: ```ts function viteMockPlugin(options?: MockServerPluginOptions): any; ``` vite mock 插件。 其中 `options` 的类型 `MockServerPluginOptions` 参考 [mockServer 配置项](#mockserver),但不支持其中的 `port` 字段。 使用示例: ```ts // vite.config.ts import { defineConfig } from 'vite'; import { viteMockPlugin } from 'yapi-ai-mock'; export default defineConfig({ plugins: [..., viteMockPlugin()], }); ``` ### `webpackMockMiddleware` - 类型: ```ts function webpackMockMiddleware( httpServer: Server | null, options?: MockServerPluginOptions, ): Promise<vite.Connect.NextHandleFunction>; ``` webpack mock 中间件。 其中 `options` 的类型 `MockServerPluginOptions` 参考 [mockServer 配置项](#mockserver),但不支持其中的 `port` 字段。 使用示例: ```ts // webpack.config.js const { webpackMockMiddleware } = require('yapi-ai-mock'); module.exports = { devServer: { onBeforeSetupMiddleware: async devServer => { const mockMiddleware = await webpackMockMiddleware(devServer.app); devServer.app.use(mockMiddleware); }, }, }; ``` ## Cli 命令 | 命令 | 说明 | | ------------------------- | ------------------------------------- | | `npx yam` | 生成 mock 文件 | | `npx yam -c=配置文件路径` | 指定配置文件并生成 mock 文件 | | `npx yam init` | 初始化配置文件,默认配置文件类型为 ts | | `npx yam init -t=js` | 指定js文件类型初始化配置文件 | | `npx yam serve` | 启动 mock 服务器,默认端口号为 3000 | | `npx yam serve -p=端口号` | 指定端口启动 mock 服务器 | ## 版权 [MIT](https://github.com/qiuxchao/yapi-ai-mock/blob/main/LICENSE) ©️ [qiuxchao](https://github.com/qiuxchao) 本项目的灵感来源于这些项目: - [TypeChat](https://github.com/microsoft/TypeChat/tree/main) - [yapi-to-typescript](https://github.com/fjc0k/yapi-to-typescript) - [vite-plugin-mock-dev-server](https://github.com/pengzhanbo/vite-plugin-mock-dev-server)
使用 LLM,将 YAPI 接口文档生成为本地的 Mock 文件。
ai,mock,typechat,yapi,yapi-codegen,typescript,vite-plugin,webpack-dev-middleware,dev,javascript
2023-07-21T01:40:23Z
2023-10-10T06:51:00Z
2023-09-15T10:46:05Z
1
0
94
0
0
2
null
MIT
TypeScript
AnupThakurwar/MovieProject
master
# Getting Started with Create React App This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). ## Available Scripts In the project directory, you can run: ### `npm start` Runs the app in the development mode.\ Open [http://localhost:3000](http://localhost:3000) to view it in your browser. The page will reload when you make changes.\ You may also see any lint errors in the console. ### `npm test` Launches the test runner in the interactive watch mode.\ See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. ### `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](https://facebook.github.io/create-react-app/docs/deployment) for more information. ### `npm run eject` **Note: this is a one-way operation. Once you `eject`, you can't go back!** If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. ## Learn More You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). To learn React, check out the [React documentation](https://reactjs.org/). ### Code Splitting This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) ### Analyzing the Bundle Size This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) ### Making a Progressive Web App This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) ### Advanced Configuration This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) ### Deployment This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) ### `npm run build` fails to minify This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
React Movies is a web application designed to show popular movies and has feature of searching your favorite movie or adding your favorite movie to list. user can create its own playlist ,view movie collection, play movie trailers along with supported dark theme support.
bootstrap5,html5,javascript,reactjs,reactrouter,scss,context-api,redux,redux-thunk,redux-toolkit
2023-08-03T08:19:54Z
2023-08-23T08:21:26Z
null
2
0
7
0
0
2
null
null
SCSS
ArgyPorgy/EverywhereGPT
main
Follow the Setup Instructions : # Step 1: # Go to Openai's official website : https://platform.openai.com/account/api-keys From there get yourself a secret key, thats your API key. Copy paste your own OpenAI API key in the "content_script.js" file, at key = ""; # Step 2: Open a web browser (preferably Google Chrome or Firefox). Access the browser's extensions or add-ons page. Enable developer mode or a similar option. # Step 3: Load the Extension Load the EverywhereGPT extension into the web browser. This may involve clicking on buttons like "Load unpacked" or "Add extension." # Step 4: Confirm Extension Installation Once the extension is added, you may see its icon in the browser's toolbar. This indicates that the extension has been successfully installed. # Step 5: Test the Extension Navigate to any empty text box where you want to utilize the extension. Click once in the text box, and EverywhereGPT's icon will appear. Enter your prompt (instruct it what to do), and click the icon when finished You can also move the icon to wherever you wish by using your mouse. Congratulations! You've successfully set up and run the EverywhereGPT extension on your PC. Enjoy its capabilities to enhance your online interactions. ## PS : This project is still under development stage so this may not work properly on some webpages. Make sure to reload both the webpage and the extension if it doesnt work.
Its a web extension that lets you use chatGPT on any website you want
ai,chatgpt,extension-chrome,generative-ai,javascript,ml,openai-api
2023-08-06T12:00:44Z
2023-09-13T13:19:53Z
null
1
0
12
0
0
2
null
null
JavaScript
Medmly20208/PrimeKitUISite
main
# PrimeKitUI
landing page of PrimeKitUI an open source project I created
component,customizable,javascript,reactjs,tailwindcss
2023-08-01T21:40:44Z
2023-08-07T19:27:43Z
null
1
0
7
0
0
2
null
null
JavaScript
Amadeo-Frontend/chatgpt
main
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). ## Getting Started First, run the development server: ```bash npm run dev # or yarn dev # or pnpm dev ``` Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file. [API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`. The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. ## Learn More To learn more about Next.js, take a look at the following resources: - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! ## Deploy on Vercel The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
null
javascript,nextjs,tailwindcss
2023-07-25T05:38:29Z
2023-07-25T06:03:46Z
null
1
0
2
0
0
2
null
null
JavaScript
Uzair-Manzoor/Testing-Practice
main
# Test This repository contains JavaScript functions and corresponding tests written using the Jest library. The tests follow the AAA (Arrange-Act-Assert) pattern and aim to ensure the correctness of the implemented functions. ## Table of Contents - [Function Descriptions](#function-descriptions) - [Getting Started](#getting-started) - [Running the Tests](#running-the-tests) ## Function Descriptions ### stringLength(string) This function takes a string as an argument and returns the number of characters in the string. It also checks if the string is at least 1 character long and not longer than 10 characters. If these conditions are not met, the function throws errors. ### reverseString(string) The `reverseString` function takes a string as an argument and returns the reversed version of the string. ### Calculator Class The `Calculator` class provides basic arithmetic operations: `add`, `subtract`, `multiply`, and `divide`. Each method takes two numbers as arguments and performs the corresponding operation. The `divide` method checks for division by zero and throws an error if encountered. ### capitalize(string) The `capitalize` function takes a string as an argument and returns the same string with the first character capitalized. It throws an error if the input is not a string. ## Getting Started To get started with this project, follow these steps: 1. Clone the repository: `git clone https://github.com/Uzair-Manzoor/Testing-practice.git` 2. Install the dependencies: `npm install` or `yarn install` (replace with your preferred package manager) ## Running the Tests You can run the tests by executing the following command: ```bash npm test ``` This command will run all the test suites and display the results. Make sure you have installed the dependencies before running the tests. Feel free to explore the test files in the repository to see the specific test cases and assertions for each function. ## Contributing Contributions to this project are welcome. If you find any issues or would like to add new tests or functions, please open an issue or submit a pull request. ## License This project is licensed under the [MIT License](LICENSE).
Practical tests for JavaScript functions using the Jest library to make sure the AAA pattern has been followed. The purpose is to make tests easier for other developers to read and understand. Also TDD approach is been practiced
javascript,jest-tests,strings-manipulation
2023-07-25T16:24:26Z
2023-07-25T17:56:49Z
null
1
1
7
0
0
2
null
MIT
JavaScript
BakhadyrovF/kss-cli
master
# KSS-CLI: Keep Secrets Safe - Command Line Interface **KSS-CLI** is a powerful and secure Command Line Interface (CLI) tool designed to help developers manage and store sensitive information, such as passwords, API keys, and other secrets, in a safe and encrypted manner. With a strong focus on security and ease of use, **KSS-CLI** utilizes a Secrets Manager approach, allowing users to securely store their secrets on their local devices and access them through the CLI. ## Prerequisites * `macOS` * `NodeJS` ## Installation Using **npm**: ```bash npm install -g kss-cli ``` Using **yarn**: ```bash yarn global add kss-cli ``` ## Key Features **Encryption Key Management**: When you run any command for the first time, **KSS-CLI** will attempt to retrieve the encryption key from the system's keychain. If the key is not found, **KSS-CLI** will generate a cryptographically secure encryption key and store it in the **keychain**. This ensures that your secrets remain secure, and **KSS-CLI** can access the key without further user intervention. **Passwords/Secrets Management**: **KSS-CLI** securely stores passwords and secrets in an encrypted form in system's **keychain** also. All encryption and decryption operations are performed using the encryption key, ensuring your sensitive information is protected. **Keychain**: Read more about [keychain](https://en.wikipedia.org/wiki/Keychain_(software)). ## Commands 1. **Add (`add`) Command**: Use `kss-cli add` to add new secrets. 2. **Remove (`rm`) Command**: Use `kss-cli rm` to remove specific secrets. **KSS-CLI** will perform a search based on the provided `secret-name` and prompt for authorization before removing the secret. 3. **Copy (`cp`) Command**: Use `kss-cli cp` to copy specific secrets to the clipboard. KSS-CLI will perform a full-text search based on the provided `secret-name` and prompt for authorization before copying the secret. 4. **List (`ls`) Command**: Use `kss-cli ls` to list all stored secrets. Provide a `[name]` argument to filter the results based on `secret-name`. 5. **Config (`config`) Command**: Use `kss-cli config` to change configuration options. Currently, the available option is `keychain-always-allow`, which determines whether your app has "Always Allow" access in the keychain. By default, this option is set to `enabled`. # Examples **Add (`add`) Command**. Use the `add` command to securely store a new secret: ![add command example](https://raw.githubusercontent.com/BakhadyrovF/kss-cli/master/media/examples/add.gif) **Remove (`rm`) Command**. Use the `rm` command to remove a specific secret: ![rm command example](https://raw.githubusercontent.com/BakhadyrovF/kss-cli/master/media/examples/rm.gif) **Copy (`cp`) Command**. Use the `cp` command to copy a specific secret to the clipboard: ![cp command example](https://raw.githubusercontent.com/BakhadyrovF/kss-cli/master/media/examples/cp.gif) **List (`ls`) Command**. Use the `ls` command to list all stored secrets or filter results based on `secret-name`: ![ls command example](https://raw.githubusercontent.com/BakhadyrovF/kss-cli/master/media/examples/ls.gif)
Keep Secrets Safe - Command Line Interface
javascript,keychain,keychain-wrapper,macos,nodejs,npm-package,secret-management,secrets,typescript
2023-07-24T08:35:02Z
2023-07-28T13:52:27Z
null
1
0
41
0
0
2
null
MIT
TypeScript
jojosuelobo/babel
main
<h1 align="center"> <p align="center">Babel</p> <img src="./public/logo.png" alt="logo UVV" width="450"> </h1> ![GitHub License](https://img.shields.io/github/license/jojosuelobo/eng-lab-soft) ![GitHub contributors](https://img.shields.io/github/contributors-anon/jojosuelobo/eng-lab-soft) ![GitHub last commit (by committer)](https://img.shields.io/github/last-commit/jojosuelobo/eng-lab-soft) ![GitHub forks](https://img.shields.io/github/forks/jojosuelobo/eng-lab-soft) [![PRs welcome](https://img.shields.io/badge/PRs-welcome-ff69b4.svg)](https://github.com/nhn/tui.editor/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) Projeto inspirado no Listography, projetado para integrar a criação de listas com uma rede social. ## Pré requisitos Para o funcionamento da aplicação, é necessário a executação tanto do client, quanto do server #### Client <img alt="Static Badge" src="https://img.shields.io/badge/node-v20.9.0-red"> <img alt="Static Badge" src="https://img.shields.io/badge/npm-v6.14.18-red"> #### Server <img alt="Static Badge" src="https://img.shields.io/badge/dotnet-v6.0.24-blue"> <img alt="Static Badge" src="https://img.shields.io/badge/dotnet_sdk-v7.0.403-blue"> ## Development setup ### [Server](https://github.com/jojosuelobo/eng-lab-soft-back) ```sh git clone https://github.com/jojosuelobo/eng-lab-soft-back.git ``` ```sh cd WebApplication1/WebApplication1 ``` ```sh dotnet build ``` ```sh dotnet run WebApplication1 ``` Após os comandos o Swagger será aberto na url: **https://localhost:7154/swagger/index.html** ### Client ```sh git clone https://github.com/jojosuelobo/eng-lab-soft.git ``` ```sh npm i ``` ```sh npm run dev ``` ## 📫 Contribuindo com o projeto Para contribuir com a Babel, siga estas etapas: 1. Bifurque este repositório. 2. Crie um branch: `git checkout -b <nome_branch>`. 3. Faça suas alterações e confirme-as: `git commit -m '<mensagem_commit>'` 4. Envie para o branch original: `git push origin <nome_do_projeto> / <local>` 5. Crie a solicitação de pull. Como alternativa, consulte a documentação do GitHub em [como criar uma solicitação pull](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request). ## Contribuidores ✨ <table> <tr display="flex"> <td align="center"><a href="https://github.com/jojosuelobo"><img src="https://github.com/jojosuelobo.png" width="100px;" alt="jojosuelobo"/><br /><sub><b>jojosuelobo</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/commits?author=donavon" title="Code"></a></td> </tr> <tr> <td align="center"><a href="https://github.com/Arctic-Husky"><img src="https://github.com/Arctic-Husky.png" width="100px;" alt="jojosuelobo"/><br /><sub><b>Arctic Husky</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/commits?author=donavon" title="Code"></a></td> </tr> <tr> <td align="center"><a href="https://github.com/rmftelier"><img src="https://github.com/rmftelier.png" width="100px;" alt="jojosuelobo"/><br /><sub><b>rmftelier</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/commits?author=donavon" title="Code"></a></td> </tr> <tr> <td align="center"><a href="https://github.com/MatheusCSouza30"><img src="https://github.com/MatheusCSouza30.png" width="100px;" alt="jojosuelobo"/><br /><sub><b>MatheusCSouza30</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/commits?author=donavon" title="Code"></a></td> </tr> <tr> <td align="center"><a href="https://github.com/GALI3600"><img src="https://github.com/GALI3600.png" width="100px;" alt="jojosuelobo"/><br /><sub><b>GALI3600</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/commits?author=donavon" title="Code"></a></td> </tr> <tr> <td align="center"><a href="https://github.com/dalcim"><img src="https://github.com/dalcim.png" width="100px;" alt="jojosuelobo"/><br /><sub><b>dalcim</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/commits?author=donavon" title="Code"></a></td> </tr> </table> ## 📜 License This software is licensed under the [MIT](./LICENSE) ©
Projeto inspirado no Listography, projetado para integrar a criação de listas com uma rede social.
csharp,design,javascript,react,sass
2023-08-06T16:05:54Z
2023-11-22T23:44:21Z
null
5
39
197
0
2
2
null
MIT
JavaScript
Tarunmeena0901/Coursii
main
To start the website $ replace the mongodb databse url in .env while $ run the backend with "node server/index.js" $ start the front-end with "npm run dev" in the main directory Sign with your new account
A website where user or admin login to his/her account and one can launch there own course or can join courses launched by others. made using react.js , recoil library , Express.js , Mongodb
express,javascript,mongo,nodejs,react,recoil,axios,grid-layout,jwt-authentication
2023-07-29T17:53:12Z
2023-11-27T13:53:19Z
null
1
0
10
0
0
2
null
MIT
JavaScript
curumim15/GestaoExplicacoes
main
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p> <p align="center"> <a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a> <a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a> <a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a> <a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a> </p> ## About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as: - [Simple, fast routing engine](https://laravel.com/docs/routing). - [Powerful dependency injection container](https://laravel.com/docs/container). - Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage. - Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent). - Database agnostic [schema migrations](https://laravel.com/docs/migrations). - [Robust background job processing](https://laravel.com/docs/queues). - [Real-time event broadcasting](https://laravel.com/docs/broadcasting). Laravel is accessible, powerful, and provides tools required for large, robust applications. ## Learning Laravel Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework. You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch. If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 2000 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library. ## Laravel Sponsors We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell). ### Premium Partners - **[Vehikl](https://vehikl.com/)** - **[Tighten Co.](https://tighten.co)** - **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)** - **[64 Robots](https://64robots.com)** - **[Cubet Techno Labs](https://cubettech.com)** - **[Cyber-Duck](https://cyber-duck.co.uk)** - **[Many](https://www.many.co.uk)** - **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)** - **[DevSquad](https://devsquad.com)** - **[Curotec](https://www.curotec.com/services/technologies/laravel/)** - **[OP.GG](https://op.gg)** - **[WebReinvent](https://webreinvent.com/?utm_source=laravel&utm_medium=github&utm_campaign=patreon-sponsors)** - **[Lendio](https://lendio.com)** ## Contributing Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions). ## Code of Conduct In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct). ## Security Vulnerabilities If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed. ## License The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
Este trabalho consistiu em criar um site, com capacidade de gerir utilizadores, associados, notícias, explicações e professores/alunos. Os requisitos incluíam a implementação de operações de criação, edição, consulta e exclusão para cada entidade mencionada.
css,html,javascript,laravel,mysql-database,php
2023-08-06T11:16:31Z
2023-08-06T11:18:36Z
null
1
0
1
0
0
2
null
null
Blade
JacksonSantin/lp-form-contact
main
<h1 align="center"> Landing Page Contato </h1> <p align="center"> <img alt="GitHub language count" src="https://img.shields.io/github/languages/count/JacksonSantin/lp-form-contact?color=%238257E5"> <img alt="GitHub top language" src="https://img.shields.io/github/languages/top/JacksonSantin/lp-form-contact?color=%238257E5"> <img alt="Feito por Jackson Dhanyel Santin" src="https://img.shields.io/badge/feito%20por-Jackson-%238257E5"> </p> <p align="center"> <a href="#-sobre-o-projeto">Sobre</a> • <a href="#-autor">Autor</a> • <a href="#-licença">Licença</a> </p> --- ## 💻 Sobre o projeto **Landing Page Contato** - Aplicação desenvolvida para praticar o básico da programação, html, css, javascript e consumindo API do SMTPjs para envio de e-mail. --- ## 🖼️ Imagem do Projeto ![image](https://github.com/JacksonSantin/lp-form-contact/assets/30778051/9d5d7b9b-883c-42a3-8a0c-b030ebfa4775) --- #### **Utilitários** - Editor: **[Visual Studio Code](https://code.visualstudio.com/)** --- ## 👨‍💻 Contribuidores <table> <tr> <td align="center"><a href="https://curriculum-vitae-jacksonsantin.vercel.app/"><img style="border-radius: 50%;" src="https://avatars.githubusercontent.com/u/30778051?v=4" width="100px;" alt=""/><br /><sub><b>Jackson Dhanyel Santin</b></sub></a></td> </tr> </table> ## 💪 Como contribuir para o projeto 1. Faça um **fork** do projeto. 2. Crie uma nova branch com as suas alterações: `git checkout -b my-feature` 3. Salve as alterações e crie uma mensagem de commit contando o que você fez: `git commit -m "feature: My new feature"` 4. Envie as suas alterações: `git push origin my-feature` --- ## 🦸 Autor <table> <tr> <td align="center"><a href="https://curriculum-vitae-jacksonsantin.vercel.app/"><img style="border-radius: 50%;" src="https://avatars.githubusercontent.com/u/30778051?v=4" width="100px;" alt=""/><br /><sub><b>Jackson Dhanyel Santin</b></sub></a></td> </tr> </table> <a href="https://instagram.com/jackson_santin" target="_blank"><img src="https://img.shields.io/badge/-Instagram-%23E4405F?style=for-the-badge&logo=instagram&logoColor=white" target="_blank"></a> <a href="https://twitter.com/dhanyeljack" target="_blank"><img src="https://img.shields.io/badge/Twitter-1d9bf0?style=for-the-badge&logo=twitter&logoColor=white" target="_blank"></a> <a href="https://fb.com/jackson.santin.52" target="_blank"><img src="https://img.shields.io/badge/Facebook-1877f2?style=for-the-badge&logo=facebook&logoColor=white" target="_blank"></a> <a href = "mailto:jackdhanyelsn@gmail.com"><img src="https://img.shields.io/badge/-Gmail-%23333?style=for-the-badge&logo=gmail&logoColor=white" target="_blank"></a> <a href="https://www.linkedin.com/in/jackson-dhanyel-santin" target="_blank"><img src="https://img.shields.io/badge/-LinkedIn-%230077B5?style=for-the-badge&logo=linkedin&logoColor=white" target="_blank"></a> <a href="https://curriculum-vitae-jacksonsantin.vercel.app" target="_blank"><img src="https://img.shields.io/badge/-JDS SISTEMAS-333333?style=for-the-badge&logo=web&logoColor=white" target="_blank"></a> --- ## 📝 Licença Este projeto esta sobe a licença [MIT](https://github.com/JacksonSantin/lp-form-contact/blob/master/LICENSE). Feito com ❤️ por Jackson Dhanyel Santin 👋🏽 [Entre em contato!](https://curriculum-vitae-jacksonsantin.vercel.app/contato) ---
Landing page com formulário de contato. Utiliei Toasty para mostrar mensagem de sucesso e smtpjs para o envio do e-mail.
css3,email,html5,javascript,smtpjs,tiltjs,toastify
2023-07-28T16:52:49Z
2023-07-28T17:02:11Z
null
1
0
5
0
0
2
null
MIT
HTML
leon-junio/elf-alfa-hackathon
main
## Site de amostragem da aplicação: - https://elf.servehttp.com:8023/internal/login - https://elf.servehttp.com:8023/report - https://elf.servehttp.com:8023 ## Documentação da API: - https://elf.servehttp.com:8030/swagger-ui.html # elf-alfa-hackathon repo Repositório do projeto para a Alfa Hackathon 2023. Backend e frontend inclusos nesse repositório. Autores: Edmar, Felipe e Leon. Faculdade: PUC Minas Praça da Liberdade. - Leon Junio: Backend, banco de dados e ambiente - Edmar: Frontend e UX - Felipe: Backend, Lider de projeto e suporte # ELF - Projeto para Alfa Hackathon 2023 ELF contempla o código utilizado no frontend, backend e aplicações de deploy. ## Stack utilizada **Front-end:** Typescript, Javascript, Next 13, React **Back-end:** Java, Spring boot 3.1.2, Spring JWT, Spring Web 6 ## Documentação das rotas do backend **Documentação API REST:** /swagger-docs.html ## Autores - [@Leon Junio](https://www.github.com/leon-junio) - [@Edmar Oliveira](https://www.github.com/felagmoura) - [@Felipe Moura](https://www.github.com/Lexizz7)
Repositorio de códigos da equipe Bovinos Mercantis. Membros: Edmar, Felipe e Leon. Backend e frontend disponiveis nesse repositorio. @pucminas
compression,hackathon-project,java,javascript,jwt-authentication,opencv,react,rest-api,shadcn-ui,spring-boot
2023-08-04T22:39:49Z
2023-08-10T03:13:52Z
2023-08-10T03:13:52Z
12
0
58
0
0
2
null
GPL-3.0
TypeScript
Hashuudev/Mapty-Workouts
main
# Mapty Mapty is a map application made with Vanilla JavaScript to store workouts like running and cycling. <br> Discover the ultimate workout tracking tool with Mapty - a unique application that utilizes a huge map to log your exercise routes. # Mapty-Workouts This is a web application where the goal is to log the workouts(running or cycling) for the users in their desired location and set some specifications for their workout accordingly. This application is built using Advanced Javascript with Object-Oriented Programming which uses Geolocation APIs, Browser APIs along with some External libraries. # Technology-Used * HTML * CSS * JavaScript * Leaflet Api # Key-Functionality The user can choose any point on the map and choose between running or cycling. In order to submit the workout, the user needs to fill out several details like distance, duration, cadence or elevation. All the workout will be saved after choosing any new workout option. The user is able to find the workout on the map by clicking on the list. The list contains workout details like pace, cadence, duration, speed as well as the date of the workout. If the user reloads the page, all the data will be saved. * Real time geolocation update. * Custom map by leaflet API. * Ability to log a workout(Running or Cycling) to specific location. * If running workout then user can set his/her workout distance, duration, cadence ,then application check the data validation and calculate the pace. * If workout is cycling then user can set his/her workout distance, duration, elevation gain then application check the data validation and calculate the speed. * All the workout information will appear in a workout list. * A Map marker will also set on the map for specific workout with date and workout type. * User can click on the workout to move the marker to see his/her different workout info on the map. * All the workout information will save in the localstorage so that application will not loose its stat in case browser is load. Ability to delete all workouts. # Future-Functionality * Ability to delete a workout. * Ability to edit a workout. * Create 'Add Workout' button to better improve the App`s UX and UI. * Ability to sort workouts by a certain field (e.g. distance). * Re-build Running & Cycling objects exiting local storage. * More realistic error and confirmation messages. * Ability to position the map to show all workouts. * Ability to draw lines and shapes instead of just points. * Display weather data for workout time and place . * Improve responsiveness for mobile device and customize the UI to make more user friendly. # Screenshots ![1](https://github.com/Hashuudev/Mapty-Workouts/assets/94761963/98bb7c33-d041-472f-af83-fae89f6196ed)
A Map application made with Vanilla JavaScript to store workouts like running and cycling. An awesome challenge provided by Jonas Schmedtmann in "The Complete JavaScript Course: From Zero to Expert!"
beginner-project,browser-api,css,front-end-development,geolocation-api,html,javascript,leaflet,leaflet-map,local-storage
2023-07-23T09:13:04Z
2023-07-23T09:32:42Z
null
1
0
11
0
0
2
null
null
JavaScript
ecryptoguru/OnchainNFTDAO
master
# AnkitPunks NFT DAO This Full-stack Dapp has been made using Next.js@12 React framework For backend Solidity, JS and Openzepelin libraries have been used in Hardhat Development Environment. Wallet-connect functioality has also been integrated and 100s of wallets including Metamask, etc can be easily connected to the Dapp. The DAO is for holders of our NFT Collection - AnkitPunks. From the ETH gained through the sale of the NFTs, a treasury has been built. The NFT holders can create and vote on proposals to use that ETH for purchasing other NFTs from an FAKENFT marketplace, and speculate on price. 📝 Requirements Anyone who owns a AnkitPunks NFT can create a proposal to purchase a different NFT from an NFT marketplace Everyone with a AnkitPunks NFT can vote for or against the active proposals Each NFT counts as one vote for each proposal Voters cannot vote multiple times on the same proposal with the same NFT If majority of the voters vote in favor of the proposal by the deadline, the NFT purchase happens automatically from the marketplace 🔩 What we will make First, we will create a basic NFT contract for the AnkitPunks collection so we have something to test with. Second, for the DAO to be able to purchase NFTs automatically on-chain when a proposal is passed, we need to use an on-chain NFT marketplace. While there exist a lot of on-chain NFT Marketplaces such as Seaport by OpenSea - we will create our own fake little NFT Marketplace that simulates the behavior of a real one to keep things simple and not turn this into a lesson about understanding the Seaport codebase. Third, we will write a custom smart contract for the DAO itself where proposals can be created, voted upon, and executed on-chain. Lastly, we will build a simple website using Next.js to allow users to create and vote on proposals. Try running some of the following tasks: ```shell npm init --yes npm install --save-dev hardhat @nomicfoundation/hardhat-toolbox npx hardhat npm install @openzeppelin/contracts npm install dotenv npx hardhat run scripts/deploy.js --network sepolia npx create-next-app@12 npm install @rainbow-me/rainbowkit wagmi viem npm run dev ```
This Full-stack Dapp has been made using Next.js@12 React framework For backend Solidity, JS and Openzeppelin libraries have been used in Hardhat Development Environment.
dao,javascript,nextjs,nft,solidity,solidity-contracts,web3,erc1155,full-stack
2023-08-05T11:48:59Z
2023-10-15T09:41:34Z
null
1
0
6
0
0
2
null
null
JavaScript
devgaab/proj-landing-page-minecraft
main
<h1 align="center"> Landing Page de Minecraft </h1> <img src=".github/preview-cover.jpg" alt="Demonstração do projeto para desktop." width="100%"/> ### 💻 Projeto Um projeto simples de Landing Page com o tema de Minecraft Web Responsivo. ### ⚙ Funcionalidades - Projeto responsivo - Menu de navegação hamburguer - Scrollbar personalisado ### 🚀 Tecnologias - HTML - CSS - JavaScript
Esse projeto é uma landing page feito com HTML, CSS e um pouco de JavaScript.
css3,html5,javascript,responsive
2023-08-02T00:01:27Z
2024-01-14T05:00:39Z
null
1
0
9
0
0
2
null
null
CSS
rtasalem/barbie-ecommerce-website
main
# Barbie E-commerce Website ### Authors Rana Salem ([LinkedIn](https://www.linkedin.com/in/ranatasalem/) | [GitHub](https://github.com/rtasalem)), Maryam Islam ([LinkedIn](https://www.linkedin.com/in/marzcreatives/) | [GitHub](https://github.com/marzcreatives)), Laila Al-Eissa ([LinkedIn](https://www.linkedin.com/in/lailaaleissa/) | [GitHub](https://github.com/lailien3)), Viktorija Blumberga ([LinkedIn](https://www.linkedin.com/in/viktorijablumberga/) | [GitHub](https://github.com/viktorijabb)), Kuljeet Panesar ([LinkedIn](https://www.linkedin.com/in/kuljeetpanesar/) | [GitHub](https://github.com/KuljeetPanesar)), Andreea-Daniela Baciu ([LinkedIn](https://www.linkedin.com/in/andreeadanielabaciu/) | [GitHub](https://github.com/AndreeaDanielaBaciu)), and Nadeen Bayley. ## Description This website was submitted as a final group project when the authors were training towards a Tech Industry Gold Credential in software development, receiving their training through FDM Group. The project is a Barbie themed e-commerce website that sells Barbie themed clothing. The website has functionality to explore through the website pages showing particular collections of outfits and items. Refer to the initial commit made to the main branch to gain an idea of what the authors achieved in 4 days before submitting the project. This repository now serves for the authors to continue working on what was built in those 4 days. ## Getting Started The [start script](https://github.com/rtasalem/barbie-ecommerce-website/blob/main/start) can be used to run the entire project using a single command: `./start`.<br> Note that you will likely need to have [Maven](https://maven.apache.org/index.html) installed (if not already) on your machine to allow execution of `mvn` commands.<br><br> To run the project manually: - Navigate to the `backend` directory (`cd backend`), locate the `BarbieEcommerceWebsiteApiApplication.java` file (`src/main/java/com/fdmgroup/api/BarbieEcommerceWebsiteApiApplication.java`) and click `Run` (this applies if you are using VS Code. In other IDEs like Eclipse, import the project as a Maven project, right click on the `backend` directory of the project and select to run as a Spring Boot Application). - Navigate to the `frontend` directory (`cd ..` followed by `cd frontend`) - Run `npm i` (or `npm insall`) followed by `npm start` to load the frontend. This can be confirmed by visiting `http://localhost:3000` via a browser. ## Project Status WIP (work in progress): not all desired functionality has been achieved, this will be improved upon over time. ### DoD The e-commerce website is considered “done” when it is functional, responsive, and meets the following criteria: all core features, including product listing, shopping basket, user registration, login and logout functionality are implemented and functioning correctly. The user interface is polished, with intuitive navigation menus, well-designed pages and smooth transitions. The website is at least 80% tested, and the code is well documented. ## Roadmap - Altering resizing of webage to make it suitable for all screen sizes - Adding images to cart - Adding wishlist functionality in front- and back-end - Updating tests to ensure they all work - Adding an admin side to contribute to the addition of new items/maintenance of an inventory - Ensuring all tests pass for all controller and service classes (code coverage is currently 93.8%) ## Team Organisation Whilst working on this project, the authors used Scrum and Agile principles to organise and prioritise their tasks. This included daily scrums, a scrum retrospective, working in sprints, and composing a product backlog. Kanban boards and product backlogs were managed using Jira Software.
This Barbie-themed e-commerce website is a final group project which was submitted during the authors' training towards a Tech Industry Gold Foundation Credential in software development. The back-end utilises a RESTful API and the front-end was made using React.
css,h2-database,html,java,javascript,node-js,react,rest-api,spring-boot,spring-boot-devtools
2023-07-25T13:52:49Z
2024-02-03T00:00:41Z
null
5
1
17
0
2
2
null
null
Java
AnshSinghSonkhia/nextjs-todo-app
master
# nextjs-todo-app
null
html,javascript,nextjs,tailwindcss,todoapp
2023-08-03T12:28:53Z
2023-08-03T12:29:59Z
null
1
0
3
0
0
2
null
null
JavaScript
Luancss/Dogs
master
# 🦴 Dogs Uma rede social feita para cachorros. ## ℹ️ Sobre o projeto Este projeto consiste em uma rede social inspirada no Instagram, feita especialmente para cachorros. ## ✨ Demonstração Veja abaixo uma foto do projeto. <img alt="dashboard" src=".github/thumbdog.JPG" width="100%"> ## 🎯 Objetivo do projeto Este projeto foi desenvolvido durante o curso de React da Origamid. O Projeto no curso é desenvolvido com CSS modules. Eu me desafiei em desenvolver com styled components. ## 📝 Tecnologias Para a realização desse projeto foram utilizadas as seguintes tecnologias/linguagens: - [React](https://pt-br.reactjs.org) - [Styled components](https://styled-components.com) - [React Router Dom](https://reactrouter.com/web/guides/quick-start) - [Victory](https://formidable.com/open-source/victory/) ## ⚙️ Instalação Para que este rode em sua máquina, siga os passos abaixo: ```bash # Clone o repositório em alguma pasta em sua máquina $ git clone https://github.com/CaioAugustoo/dogs.git # Entre no repositório $ cd dogs Instale as dependências digitando no termimal: $ yarn install Rode a aplicação no modo de desenvolvimento. $ yarn start Abra http://localhost:3000 no seu navegador para visualizar o projeto ```
Social network made for dogs inspired by Instagram. Developed with React.js.
api-rest,javascript,react,styled-components,reacthookform,reacthooks
2023-07-29T22:43:32Z
2023-09-03T04:40:05Z
null
1
0
31
0
0
2
null
null
JavaScript
AndreaPontrandolfo/eslint-plugin-fsecond
master
# ESLINT PLUGIN FSECOND ESLint plugin with some opinionated and stylistic rules. ## Description This ESLint plugin currently contains 2 rules: - [prefer-destructured-optionals](./docs/rules/prefer-destructured-optionals.md) - [valid-event-listener](./docs/rules/valid-event-listener.md)
ESLint plugin with some opinionated and stylistic rules
eslint,eslint-plugin,eslintplugin,javascript
2023-07-30T22:19:08Z
2024-05-12T15:55:49Z
2024-05-12T15:55:49Z
1
1
24
0
0
2
null
null
TypeScript
Kei-K23/vanilla-javascript-games
main
# Vanilla JavaScript Games This project is for who want to learn and love with JavaScript and want to make some games using vanilla JavaScript and understand the concept within the language.
This project is for who want to learn and love with JavaScript and want to make some games using vanilla JavaScript and understand the concept within the language.
javascript,javascript-game,vanilla-javascript
2023-07-29T07:19:18Z
2023-07-29T07:54:39Z
null
1
1
3
0
0
2
null
null
JavaScript
analuiza2102/Restaurante-X
main
# Restaurante-X Projeto em andamento
Projeto Site restaurante X
css,html,javascript
2023-08-08T11:40:00Z
2023-08-08T11:50:50Z
null
1
0
2
0
0
2
null
null
HTML
sachindsilva16/Portfolio
main
<div id="header" align="center" style="display:flex;justify-content:center;align-items:center;margin-bottom:50px;margin-top:50px;"> <a href="https://sachindsilvaportfolio.vercel.app"><img src="https://github.com/amppmann/Portfolio/blob/main/Portfolio%20Home%20Page.png" style="border-radius:2rem;"/></a> <p align="center" dir="auto"> <!-- GMAIL --> <a href="mailto:sachinronson16@gmail.com"> <img src="https://www.svgrepo.com/show/452213/gmail.svg" height="40px" alt="mail" data-canonical-src="https://www.svgrepo.com/show/223047/gmail.svg" style="max-width: 100%;"> </a>&nbsp;&nbsp; <!-- INSTAGRAM --> <a href="https://www.instagram.com/sachin.dsilva_/" rel="nofollow"> <img src="https://www.svgrepo.com/show/452229/instagram-1.svg" height="40px" alt="Instagram" data-canonical-src="https://www.svgrepo.com/show/452229/instagram-1.svg" style="max-width: 100%;"> </a>&nbsp;&nbsp; <!-- TWITTER --> <a href="https://twitter.com/sachinrons123" rel="nofollow"> <img src="https://www.svgrepo.com/show/452123/twitter.svg" height="40px" data-canonical-src="https://www.svgrepo.com/show/475689/twitter-color.svg" style="max-width: 100%;"> </a>&nbsp;&nbsp; <!-- TELEGRAM --> <a href="https://t.me/ise_nmamit" rel="nofollow"> <img src="https://www.svgrepo.com/show/452115/telegram.svg" height="40px" alt="Discord" data-canonical-src="https://www.svgrepo.com/show/452115/telegram.svg" style="max-width: 100%;">&nbsp;&nbsp; <!-- LINKEDIN --> <a href="https://www.linkedin.com/in/sachin-dsilva-43169a1bb" rel="nofollow"> <img src="https://www.svgrepo.com/show/448234/linkedin.svg" height="40px" data-canonical-src="https://www.svgrepo.com/show/448234/linkedin.svg" style="max-width: 100%;"> </a>&nbsp;&nbsp; <!-- DISCORD --> <a href="https://discord.com/invite/sachindsilva#2655" rel="nofollow"> <img src="https://www.svgrepo.com/show/353655/discord-icon.svg" height="40px" alt="Discord" data-canonical-src="https://www.svgrepo.com/show/353655/discord-icon.svg" style="max-width: 100%;">&nbsp;&nbsp; </p> <h2 dir="auto"><a id="user-content--𝐇𝐞𝐥𝐥𝐨-𝐭𝐡𝐞𝐫𝐞-𝐟𝐞𝐥𝐥𝐨𝐰-𝚍𝚎𝚟𝚎𝚕𝚘𝚙𝚎𝚛𝚜-" class="anchor" aria-hidden="true" href="#-𝐇𝐞𝐥𝐥𝐨-𝐭𝐡𝐞𝐫𝐞-𝐟𝐞𝐥𝐥𝐨𝐰-𝚍𝚎𝚟𝚎𝚕𝚘𝚙𝚎𝚛𝚜-"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg></a> 𝐇𝐞𝐥𝐥𝐨 𝐭𝐡𝐞𝐫𝐞, 𝐟𝐞𝐥𝐥𝐨𝐰 &lt;𝚍𝚎𝚟𝚎𝚕𝚘𝚙𝚎𝚛𝚜/&gt;! I am 🇸​​🇦​​🇨​​🇭​​🇮​​🇳​ ​🇩​​🇸​​🇮​​🇱​​🇻​​🇦​ <a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/42378118/110234147-e3259600-7f4e-11eb-95be-0c4047144dea.gif"><img src="https://user-images.githubusercontent.com/42378118/110234147-e3259600-7f4e-11eb-95be-0c4047144dea.gif" width="30" data-animated-image="" style="max-width: 100%;"></a></h2> </div> ### `💻 About Me :` I am a __22__ y/o tech enthusiastic <img src="https://media.giphy.com/media/WUlplcMpOCEmTGBtBW/giphy.gif" width="30"> based in Karnataka, India. - 📗 Currently pursuing my 4th Bachelor of Engineering in Information Science and Engineering. - 🌱Enthusiastic in exploring and learning new stuffs. - 👉 How to reach me : **![LinkedIn Badge](https://img.shields.io/badge/LinkedIn-blue?logo=linkedin&logoColor=white&style=plastic)&nbsp;[Connect with me]( https://www.linkedin.com/in/sachin-dsilva-43169a1bb)** - 📫 Mail me @ : [letscode16@gmail.com]( 𝚖𝚊𝚒𝚕𝚝𝚘:𝚕𝚎𝚝𝚜𝚌𝚘𝚍𝚎𝟷𝟼@𝚐𝚖𝚊𝚒𝚕.𝚌𝚘𝚖) - Peace :”) ___ ### `🛠️ Languages` <p align="center" dir="auto"> <a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/d4642b1fb5a084e324973c450699a91866e0471fa93351eefa98f5383e342d27/68747470733a2f2f7777772e7376677265706f2e636f6d2f73686f772f3334393430322f68746d6c352e737667"><img src="https://www.svgrepo.com/show/373528/cpp3.svg" height="55px" data-canonical-src="https://www.svgrepo.com/show/349402/html5.svg" style="max-width: 100%;"></a> &nbsp;&nbsp;&nbsp;&nbsp; <a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/d4642b1fb5a084e324973c450699a91866e0471fa93351eefa98f5383e342d27/68747470733a2f2f7777772e7376677265706f2e636f6d2f73686f772f3334393430322f68746d6c352e737667"><img src="https://www.svgrepo.com/show/349402/html5.svg" height="50px" data-canonical-src="https://www.svgrepo.com/show/349402/html5.svg" style="max-width: 100%;"></a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/dc60322aa209118df2560b0ad9b2c39f802813b86748b9691aa0448f64928a6a/68747470733a2f2f7777772e7376677265706f2e636f6d2f73686f772f3334393333302f637373332e737667"><img src=" https://www.svgrepo.com/show/349330/css3.svg" height="50px" data-canonical-src="https://www.svgrepo.com/show/349330/css3.svg" style="max-width: 100%;"></a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/1fed07091d02bc63d741c771bc8a423fe660c8f5fab7a4ea49655c3499a3080d/68747470733a2f2f7777772e7376677265706f2e636f6d2f73686f772f3334393431392f6a6176617363726970742e737667"><img src="https://www.svgrepo.com/show/349419/javascript.svg" height="50px" data-canonical-src="https://www.svgrepo.com/show/349419/javascript.svg" style="max-width: 100%;"></a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/292f45fc7b9bab8b56ca45bd26dc3ec29b84b4641d3b3c272b1a9455af0e640e/68747470733a2f2f7777772e7376677265706f2e636f6d2f73686f772f3337343031362f707974686f6e2e737667"><img src="https://www.svgrepo.com/show/374016/python.svg" height="50px" data-canonical-src="https://www.svgrepo.com/show/374016/python.svg" style="max-width: 100%;"></a> &nbsp;&nbsp;&nbsp;&nbsp; <a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/292f45fc7b9bab8b56ca45bd26dc3ec29b84b4641d3b3c272b1a9455af0e640e/68747470733a2f2f7777772e7376677265706f2e636f6d2f73686f772f3337343031362f707974686f6e2e737667"><img src="https://www.svgrepo.com/show/452234/java.svg" height="50px" data-canonical-src="https://www.svgrepo.com/svg/452234/java.svg" style="max-width: 100%;"></a> &nbsp;&nbsp;&nbsp;&nbsp; </p> ___ ### `⚙ Frameworks` <p align="center" dir="auto"> <!-- REACT JS --> <a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/819148d68ac2798eb170d2da38c0924450f01d501b1f34b66072c4fdb1c1aa9a/68747470733a2f2f7777772e7376677265706f2e636f6d2f73686f772f3335353139302f72656163746a732e737667"><img src="https://www.svgrepo.com/show/355190/reactjs.svg" height="50px" data-canonical-src="https://www.svgrepo.com/show/355190/reactjs.svg" style="max-width: 100%;"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <!-- TAILWIND --> <a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/a02ade9e3cfc83eed0699d7189b5d2673a2def6149b4df0f8698f822ef463793/68747470733a2f2f7777772e7376677265706f2e636f6d2f73686f772f3337343131382f7461696c77696e642e737667"><img src="https://www.svgrepo.com/show/374118/tailwind.svg" height="50px" data-canonical-src="https://www.svgrepo.com/show/374118/tailwind.svg" style="max-width: 100%;"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <!-- MONGODB --> <a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/88571833/190920486-b3bdd188-056d-4cbc-9bcc-4e7b6254df74.png"><img src="https://user-images.githubusercontent.com/88571833/190920486-b3bdd188-056d-4cbc-9bcc-4e7b6254df74.png" height="50px" style="max-width: 100%;"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <!-- MYSQL --> <a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/6111cee1810d90f4383f261ec650917b1925b56599ab2962485b61315e0ad79e/68747470733a2f2f7777772e7376677265706f2e636f6d2f73686f772f3330333235312f6d7973716c2d6c6f676f2e737667"><img src="https://www.svgrepo.com/show/303251/mysql-logo.svg" height="50px" data-canonical-src="https://www.svgrepo.com/show/303251/mysql-logo.svg" style="max-width: 100%;"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <!-- NODEJS --> <a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/079db18b204feb62b36de18e68f71011a897454970b0352c38875b3a798ed59a/68747470733a2f2f7777772e7376677265706f2e636f6d2f73686f772f3435323037352f6e6f64652d6a732e737667"><img src="https://www.svgrepo.com/show/452075/node-js.svg" height="50px" data-canonical-src="https://www.svgrepo.com/show/452075/node-js.svg" style="max-width: 100%;"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </p> ___ ### `🔨 Tools : ` <p align="center" dir="auto"> <!-- GIT --> <a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/d4df888d2e1956b182592a62e52e5a22b39209ebbb65e45220161f269a10ab92/68747470733a2f2f7777772e7376677265706f2e636f6d2f73686f772f3337333632332f6769742e737667"><img src="https://www.svgrepo.com/show/373623/git.svg" height="50px" data-canonical-src="https://www.svgrepo.com/show/373623/git.svg" style="max-width: 100%;"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <!-- GITHUB --> <a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/3f7946d116b7e0e17a929a5636c3d75bd12144218ae215b6c8007a99ea2f5991/68747470733a2f2f7777772e7376677265706f2e636f6d2f73686f772f3331323235392f6769746875622e737667"><img src="https://www.svgrepo.com/show/312259/github.svg" height="50px" data-canonical-src="https://www.svgrepo.com/show/312259/github.svg" style="max-width: 100%;"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <!-- FIGMA --> <a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/320375a599482ee00864b38caa44a093f6c69d0036826600f6c466687ed8f10b/68747470733a2f2f7777772e7376677265706f2e636f6d2f73686f772f3434383232322f6669676d612e737667"><img src="https://www.svgrepo.com/show/448222/figma.svg" height="50px" data-canonical-src="https://www.svgrepo.com/show/448222/figma.svg" style="max-width: 100%;"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <!-- ADOBE PHOTOSHOP --> <a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/ce4f8ec9866b02c150ddc35f6840d5097b345676f43f1c7c8228d5e710aab62e/68747470733a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f636f6d6d6f6e732f7468756d622f612f61662f41646f62655f50686f746f73686f705f43435f69636f6e2e7376672f3130323470782d41646f62655f50686f746f73686f705f43435f69636f6e2e7376672e706e673f3230323030363136303733363137"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/af/Adobe_Photoshop_CC_icon.svg/1024px-Adobe_Photoshop_CC_icon.svg.png?20200616073617" height="50px" data-canonical-src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/af/Adobe_Photoshop_CC_icon.svg/1024px-Adobe_Photoshop_CC_icon.svg.png?20200616073617" style="max-width: 100%;"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <!-- CANVAS --> <a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/eb334b54d725510561454e90d834d30502cbbaa74e887f138efa758757023b04/68747470733a2f2f7365656b6c6f676f2e636f6d2f696d616765732f432f63616e76612d6c6f676f2d423442453235373239412d7365656b6c6f676f2e636f6d2e706e67"><img src="https://seeklogo.com/images/C/canva-logo-B4BE25729A-seeklogo.com.png" height="50px" data-canonical-src="https://seeklogo.com/images/C/canva-logo-B4BE25729A-seeklogo.com.png" style="max-width: 100%;"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </p> ___
Portfolio Website of Sachin Ronson Dsilva
css3,reactjs,scrollrevealjs,css3-grid,javascript,boxicons
2023-07-29T18:21:21Z
2024-03-29T18:06:25Z
null
2
0
53
0
0
2
null
null
JavaScript
Pilestin/Harmoni
master
# Harmoni It is a social music application where you can listen to music, create lists, see your friends and what they are listening to. [Achievement](#achievement-) [Installation and Run](#installations-and-run-) [How to play music (local)](#how-to-play-music-local-) [Goals](#goals) [Koleksiyonlar (Collections)](#koleksiyonlar-collections--) ## Achievement : - Sign up and login - Ability to listen to music - Music search - Ability to see music categories - Ability to create favourite music lists - Ability to follow users - See what your friends are listening now - Ability to listen to what your friends are listening to <img src="https://github.com/Pilestin/Harmoni/assets/56133248/99b5e4c3-08d7-41e4-9e73-6f95d68956a0" width="700px"> <img src="https://github.com/Pilestin/Harmoni/assets/56133248/b3e669d6-9334-4dca-907a-aa774330f7a5" width="700px"> <img src="https://github.com/Pilestin/Harmoni/assets/56133248/a5a275a9-7fd4-4106-9ff1-b905228443c2" width="700px"> <img src="https://github.com/Pilestin/Harmoni/assets/56133248/2832d4c0-0c69-4ae2-8201-c3cbd6aab564" width="700px"> ### Installations and Run : ```bash > git clone https://github.com/Pilestin/Harmoni > cd Harmoni > npm install > meteor ``` ### How to play music (local) : The music uploaded in the project is copied in the public/musics folder (like public/images in images). The feature of this folder is that it can be accessed from the url. Using this, the music is taken from the url (saved with the id) and turned into a playable content. e.x : http://localhost:3000/musics/C4tb7b62sYRndiApJ.mp3 on server : ```jsx WebApp.connectHandlers.use('/musics', (req, res) => { const musicFile = Assets.absoluteFilePath('musics/' + req.url.slice(1)); res.setHeader('Content-Type', 'audio/mpeg'); res.setHeader('Content-Disposition', 'attachment'); res.writeHead(200); const readStream = fs.createReadStream(musicFile); readStream.pipe(res); }); ``` on client : ```jsx const playMusic = function (music) { const musicFile = MusicFiles.findOne({ _id: music.fileId }); const musicUrl = 'http://localhost:3000/musics/' + musicFile._id + musicFile.extensionWithDot; // Sunucudan alacağınız müzik dosyasının URL'si const audioContext = new (window.AudioContext || window.webkitAudioContext)(); fetch(musicUrl) .then(response => response.arrayBuffer()) .then(buffer => audioContext.decodeAudioData(buffer)) .then(decodedData => { const audioElement = document.getElementById('audioPlayer'); audioElement.src = musicUrl; // Audio etiketine URL'yi atıyoruz audioElement.play(); // Müziği çalıyoruz }) .catch(error => console.error('Error loading audio: ', error)); Meteor.call('user_currentPlay', music, function (err, res) { if (err) { console.log("err : ", err) } console.log("res : ", res) }); } ``` ### Goals: - [x] Sign up and login - [x] Ability to listen to music - [x] Music search - [x] Ability to see music categories - [x] Ability to create music lists - [x] Ability to add friends - [x] See what your friends are listening now - [x] Ability to listen live to what your friends are listening to ### Koleksiyonlar (Collections) : : ![Untitled](https://github.com/Pilestin/Harmoni/assets/56133248/62fda4ff-3c7e-4bce-bd35-25ec018e1d1b) 1. **Kullanıcılar (Users) :** - Kullanıcıların kimlik bilgilerini, e-posta, şifre gibi giriş bilgilerini içerir. - Ayrıca kullanıcıya özel bilgiler, arkadaş listesi gibi ek özellikleri de içerebilir. - Kullanıcıların müzik listelerine ve arkadaşlarına erişimini sağlamak için (ID) oluşturulabilir. temp code : 1. **Müzik Listeleri (Playlists)** - Kullanıcıların oluşturduğu müzik listelerini temsil eder. - Her müzik listesi, bir başlık, açıklama ve müziklerin bir listesini içerebilir. - Ayrıca müzik listesine sahip olan kullanıcının kimliği ile ilişkilendirilebilir. 2. **Müzik Kategorileri (Music Categories)** - Müzik listelerini belirli kategorilere ayırmak için kullanılabilir. - Her müzik kategorisi, bir ad ve açıklama içerebilir. 3. **Canlı Dinleme (Live Listening)** - Kullanıcıların arkadaşlarının canlı olarak ne dinlediklerini takip etmek için kullanılabilir. - Canlı dinleme durumu, kullanıcının kimliği ve dinlenen müziğin kimliği ile ilişkilendirilebilir. ```jsx { "User" : { "_id" : "_??", "firstName": "Yasin", "lastName": "Ünal", "email" : "yasin@test.com", "password" : "123", "favoriteList" : [ "_mId" ], "currentPlay" : "musicId", "friendList" : ["_uId"], "createdAt" : "DATE" }, "Music" : { "_id" : "_??", "name" : "", "artist": "", "link" : "", "duration" : "", "cId" : "" }, "Categories" : { "_id" : "_??", "name" : "", "description": "" } } ```
It is a social music application where you can listen to music, create lists, and see your friends and what they are listening to.
bootstrap,css,htlm5,javascript,meteorjs,minimongo,mongodb,music-app,web-audio-api
2023-07-26T14:29:06Z
2023-09-12T11:57:32Z
null
1
0
23
0
0
2
null
null
JavaScript
Diep-Nguyen-Tara/Harvard-CS50-Project-Summary
main
# Harvard CS50 - Computer Science Projects Hello, world! This is CS50, Harvard University's introduction to the intellectual enterprises of computer science and the art of programming. Topics include: -- Computer Science. Computational Thinking. Problem Solving: Inputs, Outputs. Representation: Unary, Binary, Decimal, ASCII, Unicode, RGB. Abstraction. Algorithms. Running Times. Pseudocode. Scratch: Functions, Arguments, Return Values; Variables; Boolean Expressions, Conditionals; Loops; Events; Threads. This is a 12-week course: -- Week 1 - Scratch. Week 2 - C. Week 3 - Arrays. Week 4 - Algorithms. Week 4 - Algorithms. Week 5 - Memory (Hexadecimal, Pointer, Defining Custom Types, Dynamic Memory Allocation, Call Stacks, File Pointers). Week 6 - Data Structures (Queue, Stack, Singly-Linked list, Doubly-Linked List, Binary Search Tree, Hash table, Tries). Week 7 - Python -- (Strings, Dot notation, Loops, Tuples, Dictionaries, Libraries, File reading, Writing; other topics: Floating point imprecision, Integer Overflow). Python syntax: Variables, Conditionals, Loops, Arrays, Lists, Tuples, Dictionaries, Functions, Objects, Style. Week 8 - SQL -- Structured Query Language (Relational databases,...). Potential problems: race conditions, SQL injection attacks (little Bobby Tables). SQL is a programming language whose purpose is to query a database. MySQL is one open-source platform on which you can establish the type of relational database that SQL is most adept at working with. SQLite is another platform. Many installations of SQL come with a GUI tool called phpMyAdmin which can be used to execute database queries in a more user-friendly way. 5 common Data types in SQLite: -- BLOB(Binary large objects) INTEGER INTERGER NUMERIC(YYYY-MM-DD) REAL(float, decimal point with some number of digits thereafter) TEXT CRUD functions: -- to create data: CREATE, INSERT. to read data: SELECT. to update data: UPDATE. to delete data: DELETE, DROP. Other functions: -- AVG, COUNT, DISTINCT, LOWER, MAX, MIN, UPPER,... WHERE, LIKE, ORDER BY, LIMIT, GROUP BY. Example of functions & queries: -- SELECT * FROM favorites; (to select all). SELECT * FROM favorites; (to select all). SELECT * FROM favorites; SELECT * FROM favorites; SELECT * FROM favorites; SELECT * FROM favorites; SELECT * FROM people WHERE name LIKE 'Steve C%'; SELECT * FROM people WHERE name LIKE 'Steve C%'; SELECT * FROM people WHERE name LIKE 'Steve C%'; SELECT * FROM people WHERE name LIKE 'Steve C%'; SELECT * FROM people WHERE name LIKE 'Steve C%'; SELECT * FROM people WHERE name LIKE 'Steve C%'; SELECT * FROM people WHERE name LIKE 'Steve C%'; SELECT * FROM people WHERE name LIKE 'Steve C%'; SELECT * FROM people WHERE name LIKE 'Steve C%'; SELECT * FROM people WHERE name LIKE 'Steve C%'; SELECT COUNT(show_id) FROM genres WHERE genre = 'Comedy'; SELECT COUNT(show_id) FROM genres WHERE genre = 'Comedy'; SELECT COUNT(show_id) FROM genres WHERE genre = 'Comedy'; SELECT COUNT(show_id) FROM genres WHERE genre = 'Comedy'; SELECT COUNT(show_id) FROM genres WHERE genre = 'Comedy'; SELECT COUNT(show_id) FROM genres WHERE genre = 'Comedy'; SELECT COUNT(show_id) FROM genres WHERE genre = 'Comedy'; SELECT title FROM shows WHERE id IN (SELECT show_id FROM genres WHERE genre = 'Comedy') ORDER BY title LIMIT 10; SELECT title FROM shows WHERE id IN (SELECT show_id FROM genres WHERE genre = 'Comedy') ORDER BY title LIMIT 10; SELECT title FROM shows WHERE id IN (SELECT show_id FROM genres WHERE genre = 'Comedy') ORDER BY title LIMIT 10; SELECT title FROM shows WHERE id IN (SELECT show_id FROM genres WHERE genre = 'Comedy') ORDER BY title LIMIT 10; SELECT title FROM shows WHERE id IN (SELECT show_id FROM genres WHERE genre = 'Comedy') ORDER BY title LIMIT 10; Nested query: SELECT title FROM shows WHERE id IN (SELECT show_id FROM stars WHERE person_id = (SELECT id FROM people WHERE name = 'Steve Carell')); Join query: SELECT * FROM shows JOIN ratings ON shows.id = ratings.show_id WHERE title = 'The Office'; SELECT * FROM shows JOIN ratings ON shows.id = ratings.show_id WHERE title = 'The Office'; SELECT * FROM shows JOIN ratings ON shows.id = ratings.show_id WHERE title = 'The Office'; SELECT * FROM shows JOIN ratings ON shows.id = ratings.show_id WHERE title = 'The Office'; SELECT * FROM shows JOIN ratings ON shows.id = ratings.show_id WHERE title = 'The Office'; SELECT * FROM shows JOIN ratings ON shows.id = ratings.show_id WHERE title = 'The Office'; SELECT * FROM students JOIN assignments ON students.id = assignments.student_id JOIN houses ON houses.id = assignments.house_id; SELECT * FROM students JOIN assignments ON students.id = assignments.student_id JOIN houses ON houses.id = assignments.house_id; CREATE TABLE movies ( id INTEGER, title TEXT NOT NULL, year NUMERIC, PRIMARY KEY(id) ); CREATE TABLE stars ( movie_id INTEGER NOT NULL, person_id INTEGER NOT NULL, FOREIGN KEY(movie_id) REFERENCES movies(id), FOREIGN KEY(person_id) REFERENCES people(id) ); UPDATE favorites SET language = 'C' WHERE language ='C++'; (to replace data in the column). UPDATE favorites SET language = 'C' WHERE language = 'C++'; UPDATE favorites SET language = 'C' WHERE language = 'C++'; UPDATE favorites SET language = 'C' WHERE language = 'C++'; UPDATE favorites SET language = 'C' WHERE language = 'C++'; DELETE FROM favorites WHERE problem = 'Tideman'; DELETE FROM favorites WHERE problem = 'Tideman'; DELETE FROM favorites WHERE problem = 'Tideman'; DELETE FROM favorites WHERE problem = 'Tideman'; DELETE FROM favorites WHERE problem = 'Tideman'; DELETE FROM favorites WHERE problem = 'Tideman'; CREATE INDEX title_index ON shows (title); CREATE INDEX title_index ON shows (title); IMDb = Internet Movie Database. TSV = Tab Separated Value. TSV = Tab Separated Value TSV = Tab Separated Value Week 9 - HTML, CSS, JavaScript. -- HTML, or HyperText Markup Language, is used to describe the content of websites; CSS, Cascading Style Sheets, is used to describe the aesthetics of websites; JavaScript, is used to make websites interactive and dynamic. **1. How the internet works?** (first 50 mins) IP = Internet Protocols IP = Internet Protocols IP = Internet Protocols IP = Internet Protocols IP = Internet Protocols IP = Internet Protocols IP = Internet Protocols IP = Internet Protocols TCP = Transmission Control Protocol TCP = Transmission Control Protocol TCP = Transmission Control Protocol TCP = Transmission Control Protocol TCP = Transmission Control Protocol TCP = Transmission Control Protocol TCP = Transmission Control Protocol TCP = Transmission Control Protocol DNS = Domain Name System DNS = Domain Name System DNS = Domain Name System DNS = Domain Name System DNS = Domain Name System DNS = Domain Name System DNS = Domain Name System DNS = Domain Name System HTTP = Hypertext Transfer Protocol HTTP = Hypertext Transfer Protocol HTTP = Hypertext Transfer Protocol HTTP = Hypertext Transfer Protocol HTTP = Hypertext Transfer Protocol HTTP = Hypertext Transfer Protocol TLD = Top Level Domain TLD = Top Level Domain TLD = Top Level Domain TLD = Top Level Domain TLD = Top Level Domain curl = connect URL curl = connect URL curl = connect URL curl = connect URL 200 OK 301 Moved Permanently 302 Found 304 Not Modified 307 Temporary Redirect 401 Unauthorized 403 Forbidden 404 Not Found 418 I'm a Teapot 500 Internal Server Error 503 Service Unavailable **2. HTML** Tags: 'ul' means Unordered List 'ul' means Unordered List 'ol' means Ordered List 'ls' means List 'tr' means Table Row 'div' means Division of the page Attributes **3. CSS** CSS is not a programming language. It is a markup language to support the aesthetics of the page, things such as font size, colors, margin,... Properties Type selector Class selector ID selector Attribute selector Week 10 - Flask. -- Week 11 - Emoji. Week 12 - Cybersecurity. *Notes: -- Ctrl+C to interrupt computer PRIMARY KEY: is the unique identifier & the unique ID inside of the table. PRIMARY KEY: is the unique identifier & the unique ID inside of the table. FOREIGN KEY: is the reference to that primary key from another table, a separate table. FOREIGN KEY: is the reference to that primary key from another table, a separate table. Does FOREIGN KEY have to set the relationship? when you create the table, the programmer or the database administrator would create that relationship by using those keywords: primary key and foreign key that teaches the database what is related to what.
All projects from Computer Science CS50 course taught by David J. Malan at Harvard University. Topics: Scratch - C - Arrays - Algorithms - Memory - Data Structures - Python - SQL - HTML, CSS, JavaScript - Flask - Emoji - Cybersecurity.
c,scratch,algorithms,arrays,css,cybersecurity,data-structures,emoji,flask,html
2023-07-23T21:22:25Z
2024-01-05T05:29:53Z
null
1
0
1,101
0
0
2
null
null
null
Robin-qwerty/Getstartedwithdrones
main
# Get Started with Drones Get Started with Drones is a website designed to assist individuals in finding the most suitable drone based on their preferences and needs. By answering a series of questions, users can receive personalized recommendations to guide them in choosing their ideal drone. ## Contributing to the Project We welcome contributions to enhance the question system or improve the website's functionality. Here's how you can contribute: ### Future Plans In the future, we aim to integrate a form into the website. This form will allow users to input details about their drones, transmitters, goggles, and related information into the website's database. This data will be leveraged to assist other users in choosing the best options. Your contributions are valuable and greatly appreciated! Feel free to reach out if you have ideas or suggestions for improving the website's functionality or question system. ## Getting Started To set up the project locally and contribute, follow these steps: 1. Clone this repository: `git clone https://github.com/your-username/getstartedwithdrones.git` 2. Navigate to the project directory: `cd getstartedwithdrones` 3. Make changes, add improvements, or contribute to the question system. 4. Push your changes to a new branch: `git push origin your-branch-name` 5. Create a pull request outlining your changes for review. Thank you for considering contributing to Get Started with Drones! Together, we can create a more helpful and comprehensive platform for drone enthusiasts.
Getstartedwithdrones guide. A guide i am making for people that want to get into drones but don't know where and how to start.
drones,fpv-drones,css,html,javascript,mariadb-database,php8
2023-08-08T16:00:00Z
2024-02-09T13:26:45Z
null
1
1
33
11
2
2
null
null
Hack
notcharliee/phasesite
main
null
Phase provides a comprehensive set of tools that enable effortless management, moderation, and optimization of your Discord servers.
discord,javascript,mongodb,mongoose,nextjs,nodejs,react,tailwindcss,typescript
2023-07-21T16:05:01Z
2023-11-06T08:26:58Z
null
1
0
4
4
0
2
null
NOASSERTION
TypeScript
fu-w/html-bot-page
main
## Discord Bot Site Infrastructure! ## 📑 Site Features - [x] Simple Design - [x] Policy Page - [x] Features ## 📷 Images ![image](https://github.com/fu-w/profile/assets/74312970/b3a7acc7-70e3-4746-8959-e950f68121a2) ![image](https://github.com/fu-w/profile/assets/74312970/49f433e9-a2af-40c4-8ecd-5c42a9f3b5c6) ![image](https://github.com/fu-w/profile/assets/74312970/01ec62fd-e844-4d33-9a9e-0fcc6ced5f8b)
Web Page For Discord Bot
css,discord-bot-site,discordsite,html,javascript,site,website
2023-07-29T13:51:54Z
2023-07-29T14:43:47Z
null
1
0
6
0
0
2
null
null
CSS
KashanAdnan/Chat-Frontend
main
# React + Vite This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. Currently, two official plugins are available: - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
Chat-Frontend With React + Vite MERN Project
context-api,css,hooks-api-react,javascript,react,reactjs,tailwindcss,vite
2023-08-08T06:26:24Z
2023-08-08T06:48:04Z
null
1
0
2
0
0
2
null
null
JavaScript
zbari023/Puma_store
main
# Restuarant simple store with payment using Django, python, rest framwork and more
simple store with payment using Django, python, rest framwork and more
bootstrap5,css3,django,django-rest-framework,git,html5,javascript,python
2023-07-23T19:50:38Z
2023-08-06T21:22:36Z
null
1
0
14
0
0
2
null
null
Python
ElazzouziHassan/Portfolio-ui
main
null
Modern Portfolio UI built with React 🌟 Create a stunning online presence with this responsive and customizable portfolio website template. #Portfolio #React #WebDevelopment
javascript,jsx,portfolio-website,react,react-router
2023-08-04T17:45:51Z
2023-09-09T19:27:10Z
null
1
3
417
0
0
2
null
null
JavaScript
wastech/nestjs-graphql-auth
main
<p align="center"> <a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="200" alt="Nest Logo" /></a> </p> [circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456 [circleci-url]: https://circleci.com/gh/nestjs/nest <p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p> <p align="center"> <a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a> <a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a> <a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a> <a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a> <a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a> <a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a> <a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a> <a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a> <a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a> <a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a> <a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a> </p> <!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer) [![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)--> ## Description [Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. ## Installation ```bash $ npm install ``` ## Running the app ```bash # development $ npm run start # watch mode $ npm run start:dev # production mode $ npm run start:prod ``` ## Test ```bash # unit tests $ npm run test # e2e tests $ npm run test:e2e # test coverage $ npm run test:cov ``` ## Support Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support). ## Stay in touch - Author - [Kamil Myśliwiec](https://kamilmysliwiec.com) - Website - [https://nestjs.com](https://nestjs.com/) - Twitter - [@nestframework](https://twitter.com/nestframework) ## License Nest is [MIT licensed](LICENSE).
This repository houses the codebase for a modern web application built with NestJS, GraphQL, MongoDB, and JWT authentication.
graphql,javascript,nest,nestjs,nodejs,typescript,mongodb,mongoose
2023-07-26T20:11:23Z
2023-09-03T22:19:52Z
null
1
0
6
0
0
2
null
null
TypeScript
arjundangi01/Glossier-clone
main
# Glossier-clone ## Description As a 4-member team, we collaborated on the "Glossier-Clone" project, focusing on developing a user-friendly e-commerce website using web technologies. Our main objectives were responsive design, filtering, sorting, and search functionality. Additionally, we successfully implemented a shopping cart, payment integration. This experience allowed us to grow as front-end developers, create engaging user interfaces, and work effectively as a team. ### Tech Used - HTML - CSS - Javascript - Bootstrep - JSON-server - Local Storage ### Team Member - Arjun Dangi - Gaurav Sharma - Harsh Raj - Shubham # Work Description ## Home Page ![image](https://github.com/arjundangi01/Glossier-clone/assets/135942012/ace8bad3-fcfb-40c5-97b5-86c659dc2fe1) ## Signup Page ![image](https://github.com/arjundangi01/Glossier-clone/assets/135942012/0385fdb0-eecb-4ce9-8514-d8f6b38c6501) ## Login Page ![image](https://github.com/arjundangi01/Glossier-clone/assets/135942012/e7ae6e4e-6756-4d0f-af3f-75dabcd16f04) ## Product Page ![image](https://github.com/arjundangi01/Glossier-clone/assets/135942012/2e1da480-d820-4b7d-a0c0-4e63a934e9e4) ## Product detail page ![image](https://github.com/arjundangi01/Glossier-clone/assets/135942012/452eefb3-caae-4bb0-8fc7-cbcdde4c2ab0) ## Cart Page ![image](https://github.com/arjundangi01/Glossier-clone/assets/135942012/1c4545b1-dc8c-401e-94ac-92289e22ef12) ## Checkout page ![image](https://github.com/arjundangi01/Glossier-clone/assets/135942012/3dd2fdb1-5812-4918-89b7-2b25ebf28fc9) ## Payment Page ![image](https://github.com/arjundangi01/Glossier-clone/assets/135942012/ff7d72fb-c14b-4cc9-bf1b-ed0b07dc698d) ## Order success page ![image](https://github.com/arjundangi01/Glossier-clone/assets/135942012/112f0a46-8d47-4078-88c3-44a2003fb831)
A user-friendly E-commerce website for women beauty Products. Our project has features like Login/ Signup, Product Page, Product Detail page, Cart Page, Payment Page
css,html,javascript,api,bootstrap,json-server
2023-08-05T16:48:49Z
2023-10-07T12:45:28Z
null
4
40
161
0
3
2
null
null
HTML
codx-ak/E-Commerce
main
# Getting Started with Create React App This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). ## Available Scripts In the project directory, you can run: ### `npm start` Runs the app in the development mode.\ Open [http://localhost:3000](http://localhost:3000) to view it in your browser. The page will reload when you make changes.\ You may also see any lint errors in the console. ### `npm test` Launches the test runner in the interactive watch mode.\ See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. ### `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](https://facebook.github.io/create-react-app/docs/deployment) for more information. ### `npm run eject` **Note: this is a one-way operation. Once you `eject`, you can't go back!** If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. ## Learn More You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). To learn React, check out the [React documentation](https://reactjs.org/). ### Code Splitting This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) ### Analyzing the Bundle Size This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) ### Making a Progressive Web App This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) ### Advanced Configuration This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) ### Deployment This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) ### `npm run build` fails to minify This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
This React-based e-commerce project creates a user-friendly online shopping interface, offering seamless browsing and purchasing through intuitive components and state management.
ak,amazon,codx,codx-paradise,e-commerce,e-commerce-website,ecommerce,ecommerce-website,flipcart-clone,mern-stack
2023-08-05T11:34:13Z
2023-10-27T11:34:12Z
null
1
0
27
0
0
2
null
null
JavaScript
lucAmbr0/GreenStore
master
# Introduction - GreenStore is a concept website that I created a long time ago to simulate an e-commerce website where you shop your groceries. This store does not phisically exist and there's no actual possibility to buy or return products. - Unfortunately when this project started I didn't have any code-time extension enabled, but I can guarantee it took me many hours to make. ## :ledger: Index - [About](#beginner-about) - [Usage](#zap-usage) - [Installation](#electric_plug-installation) - [Development](#wrench-development) - [Pre-Requisites](#notebook-pre-requisites) - [File Structure](#file_folder-file-structure) - [Community](#cherry_blossom-community) - [Contribution](#fire-contribution) - [Guideline](#exclamation-guideline) - [FAQ](#question-faq) - [Resources](#page_facing_up-resources) - [Gallery](#camera-gallery) - [Credit/Acknowledgment](#star2-creditacknowledgment) - [License](#lock-license) ## :beginner: About **GreenStore** is a web page developed in **html/css/js** for demonstration purposes. There is **no commercial reality behind this project**, but only the intention to create a web page showing an online fruit and vegetable shop. Everything written inside is made up. <br> I created this project to put into **practice** some knowledge I acquired while learning **web development languages**. This project was born in 2021 and I personally brought it as a personal project to school in a more essential and raw form than what you see now. In fact, in 2022 the project was restarted from scratch to improve the order of the code and readability. <br> I decided to publish this web page to make material available to the community from which to take inspiration to create other web pages, or find inspiration for other projects. **Feel free to copy some of the code for your own projects.** Although **the shop is a fiction**, inside **you will find** a lot of interesting **information on agricultural products** and reliable average **nutritional information** taken from authoritative and cited sources. <br> The **graphic aspect** of the page was designed completely from scratch by me, and **takes inspiration from the Material You Android guidelines** made by Google, which I particularly admire. The page is **not very optimized for mobile viewing** and could cause problems if you open it in formats other than 16:9 and 9:16, I'm working to make it as responsive as possible. Also, note that this page is written in **Italian**. ## :zap: Usage This project has no practical use other than browsing a fake online store to read some information about fruit and vegetables. You might like part of the interface and in this case you could take inspiration from it. ### :electric_plug: Installation - To open the project, just click the github pages link on which the page is hosted (located at the top of this page). - There is no need to install the source code. - If you have GitHub CLI on your machine and want to clone the repository send the following command: ``` gh repo clone lucAmbr0/GreenStore ``` ## :wrench: Development Updates to this project do not arrive consistently, so there may be periods of stalemate and others with many updates. ### :notebook: Pre-Requisites This project does not require any particular requirements other than a browser. - I **highly reccomend** to open this webpage on a **chromium browser**, since not all CSS rules and styles applied are compatible with other browsers like Firefox, Edge, Safari etc. ### :file_folder: File Structure Add a file structure here with the basic details about files, below is an example. ``` . ├── js │ ├── disclaimer.js │ ├── index.js | ├── main.js | ├── negozio.js │ └── products.js ├── Media │ ├── Credits | | └── *webp icon files* | ├── Products │ | ├── DriedFruit | | | └── *webp products files* │ | ├── FreshFruit | | | └── *webp products files* │ | ├── FruttaFrescaOld | | | └── *webp products files* │ | ├── FruttaSecca | | | └── *webp products files* | | ├── Vegetables | | | └── *webp products files* │ ├── Valori Nutrizionali | | └── *webp nutrional facts files* | ├── other | | └── *icon, buttons and garbage files* ├── Account.html ├── Albicocche.html ├── Disclaimer.html ├── Negozio.html ├── README.md ├── index.html └── style.css ``` ## :cherry_blossom: Community Teamwork is important! If you want to help improve this project feel free to make changes and make a pull request appropriately using the GitHub channels ### :fire: Contribution Your contributions are always welcome and appreciated. Following are the things you can do to contribute to this project. 1. **Report a bug** <br> If you think you have encountered a bug, and I should know about it, feel free to report it and I will take care of it. 2. **Request a feature** <br> You can also request for a feature, and if it will viable, it will be picked for development. 3. **Create a pull request** <br> It can't get better then this, your pull request will be appreciated by the community. You can get started by picking up any open issues and make a pull request. > If you are new to open-source, make sure to check read more about it [here](https://www.digitalocean.com/community/tutorial_series/an-introduction-to-open-source) and learn more about creating a pull request [here](https://www.digitalocean.com/community/tutorials/how-to-create-a-pull-request-on-github). **Steps to work with feature branch** 1. To start working on a new feature, create a new branch prefixed with `feat` and followed by feature name. (ie. `feat-FEATURE-NAME`) 2. Once you are done with your changes, you can raise PR. ### :exclamation: Guideline There are no particularly stringent guidelines as this is a fairly small project, however, as a relative beginner in the world of web development, you may find the code messy or poorly optimized. Feel free to make improvements if you want, but try not to make too massive changes to the code. ## :question: FAQ - **What's this thing?** <br> This is GreenStore, an open-source webpage developed by me to simulate an online e-commerce website that sells groceries. - **What can I do with it?** <br> Essentially, nothing very productive. You may find it interesting or worth reading for some nutritional facts about food. Or maybe you'd like the UI and use it for your personal webpages. - **I don't understand what it says, why isn't it in English?** <br> Since this project was born for personal purposes it was not initially intended to be published online, so I wrote it in my native language, Italian 🇮🇹. - **Can I buy something?** <br> No, this shop is totally fake and does not intend to sell any commercial products - **How are you?** <br> It's a little cold at home now, I think I'll put on a sweater. Thanks for asking <3 ## :page_facing_up: Resources Sources and websites I used to make this project are all listed in the disclaimer/credits page of the project <3 ## :camera: Gallery Here are some screenshots of this project (took from version 0.1.2) <br> ![alt text](https://github.com/lucAmbr0/GreenStore/blob/master/GreenStoreSCREEN1.png?raw=true) ![alt text](https://github.com/lucAmbr0/GreenStore/blob/master/GreenStoreSCREEN2.png?raw=true) ![alt text](https://github.com/lucAmbr0/GreenStore/blob/master/GreenStoreSCREEN3.png?raw=true) ## :star2: Credit/Acknowledgment I'm the only one that worked on this as of now :') ## :lock: License Since this project is made using various sources from across the web and is mainly for personal use, it comes with absolutely no license. That said, if you choose to clone and use this project for public, private or commercial purposes, I still ask you not to delete my signature and links to my profiles from the files to support my work, it won't cost you anything!
html/css/js webpage to simulate an e-commerce store that sells groceries [italian language].
css,css3,html,html-css-javascript,html5,javascript,js,webpage,webpages
2023-07-24T12:49:10Z
2024-02-17T15:40:33Z
null
1
77
292
0
0
2
null
null
HTML
AnshSinghSonkhia/Task-Time-Tracker
main
# Task-Time-Tracker
Track Your Time
html,javascript,tailwindcss,timetracker
2023-08-01T13:43:33Z
2023-08-01T13:45:44Z
null
1
0
2
0
0
2
null
null
JavaScript
bennycode/typechat-demo
main
# TypeChat Demo: Travel Time Provide the travel duration for various locations using diverse transportation methods. ## How to get started? 1. Clone this repository 2. Run `npm install` 3. Create a `.env` file containing your API keys 4. Run `npm start` ## Environment variables **.env** ``` GOOGLE_MAPS_API_KEY=top OPENAI_API_KEY=secret ``` ## Useful links - https://console.cloud.google.com/apis/credentials - https://www.npmjs.com/package/@googlemaps/google-maps-services-js - https://developers.google.com/maps/documentation/distance-matrix/overview - https://platform.openai.com/account/api-keys - https://www.npmjs.com/package/typechat - https://github.com/microsoft/TypeChat/tree/main/examples
TypeChat Demo using Google Maps API
javascript,nodejs,tutorial,typechat,typescript
2023-07-27T13:38:05Z
2024-01-10T21:44:53Z
null
1
39
44
0
1
2
null
null
TypeScript
haena-j/js-algorithms
main
# js-algorithms This repository provides a collection of algorithm problems and their solutions in JavaScript. ## Structure The repository is organized as follows: - `algorithms`: Contains the JavaScript solutions for various algorithm problems. - `tests`: Contains the test cases for the algorithm solutions. ## Technologies Used - JavaScript - Jest (testing framework) ## Installation and Running 1. Clone this repository. ```sh git clone https://github.com/your-username/js-algorithms.git cd js-algorithms ``` 2. Install the required packages. ```sh npm install ``` 3. Run the tests. ```sh npm test ```
Provides a collection of algorithm problems and their solutions in JavaScript
algorithms,javascript,algorithm
2023-08-03T14:03:09Z
2024-05-02T10:09:46Z
null
1
0
71
0
0
2
null
null
JavaScript
arceprogramando/arquitectura-del-servidor
main
# Arquitectura de UNA API <img src="SwaggerAPI.PNG"></img> ## 🧞 Commands | Command | Action | | :------------------------ | :----------------------------------------------- | | `npm install` |Para instalar las dependencias necesarias del proyecto| | `npm run start:dev` |Para inicializar el proyecto en dev necesita variables de entorno | | `npm run start:test` |Para inicializar el proyecto en test necesita variables de entorno | | `npm run start:prod` |Para inicializar el proyecto en prod necesita variables de entorno | # Estructura Variables de entorno - **PORT=8080** (example) - **DB_PORT=27017** (example) - **DB_CNN=mongodb+srv://Example:Example@ecommerce.mhqm9ea.mongodb.net/** - **DB_HOST=localhost** (example) - **COLLECTION_NAME=ecommerceexample** (example) - **NODE_ENV=devexample** (example) - **GITHUB_CLIENT_ID=26cefeb1545d2aa3581a** (example) - **GITHUB_CLIENT_SECRET=b855264f7625130617f1604c340b88** (example) - **PERSISTENCE=MONGO** (example) - **EMAIL=cndograepromaar@gmail.com** (example) - **PSW_EMAIL=gugybzlvfagaarua** (example) - **BASE_URL=http://localhost:8080** (example) - **CLOUDINARYCLOUD_NAME==83sdp479q**(example) - **CLOUDINARYAPI_KEY=145546893824915**(example) - **CLOUDINARYAPISECRET=s_uCHpv-g4O1UBwM3n9kSuWWt-u**(example) ## Para la nueva estructura de mis commits voy a utilizar https://www.conventionalcommits.org/en/v1.0.0/ ### Para realizar este Arquitectura | Dependencias /Librerias | Funcionalidad | | --------------- | --------------------------------------------------------------------------- | | ✅ [node.js] | Se instalo a nivel local NodeJs.| | ✅ [express] | Se uso la libreria Express de NodeJs.| | ✅ [nodemon] |Se instalo globalmente Nodemon Se instalo como paquete de desarrollo.| | ✅ [cross-env] |Para ejecutar scripts que establecen y utilizan variables de entorno en diferentes plataformas.| | ✅ [cors] |Para que funcione como middleware que especifica los origenes permitidos, como servicios externos.| | ✅ [dotenv] |Para cargar variables de entorno desde archivos de configuración locales.| | ✅ [cookie-parser] |Que se utiliza para analizar las cookies en las solicitudes entrantes y hacerlas accesibles en req.cookies.| | ✅ [mongoose] | Interacción con la base de datos y proporciona una serie de características que facilitan el desarrollo de aplicaciones web y API que utilizan MongoDB | | ✅ [mongoose-paginate-v2] | Es una libreria para poder paginar que contiene un wrapper de paginas de diferentes estilos. | | ✅ [tailwind] | Tailwind incluido en CDN para crear diseño mas atractivo. | | ✅ [multer] | Para la configuracion de subida de archivos a travez del front , y manipularlos desde el server. | | ✅ [bcrypt] |Una libreria para poder hashear contraseñas. | | ✅ [passport] | Una libreria que funciona como middleware para hacer autentificacion de login , ya sea con esta misma o con sus extensiones. | | ✅ [passport-github2] | Estrategia de passport para poder poder hacer uso de el logeo con github. | | ✅ [connect-mongo] | Es un módulo de Node.js que se utiliza como almacén de sesiones. | | ✅ [express-session] |Esencial para manejar sesiones de usuario en aplicaciones web creadas con Express.js. | | ✅ [passport-local] |Estrategia de passport para manejar el inicio de sesion local. | | ✅ [uuid] |Libreria para crear ids aleatorios. | | ✅ [nodemailer] |Libreria para trabajar con mails. | | ✅ [express-compression] |Para comprimir. | | ✅ [http-status-codes] |Para las respuestas http en el EnumErrors. | | ✅ [winston] | Universal loggin library como storage de logs. | | ✅ [swagger-jsdoc] | Para documentar la API. | | ✅ [swagger-ui-express] | Para documentar la API. | [arceprogramando]: <https://github.com/arceprogramando> [node.js]: <http://nodejs.org> [express]: <http://expressjs.com> [nodemon]: <https://nodemon.io> [cross-env]:<https://www.npmjs.com/package/cross-env> [cors]:<https://www.npmjs.com/package/cors> [dotenv]:<https://www.npmjs.com/package/dotenv> [cookie-parser]:<https://www.npmjs.com/package/cookie-parser> [mongoose]:<https://www.npmjs.com/package/mongoose> [mongoose-paginate-v2]:<https://www.npmjs.com/package/mongoose-paginate-v2> [tailwind]:<https://tailwindcss.com> [multer]:<https://www.npmjs.com/package/multer> [bcrypt]:<https://www.npmjs.com/package/bcrypt> [passport]:<https://www.npmjs.com/package/passport> [passport-github2]:<https://www.npmjs.com/package/passport-github2> [connect-mongo]:<https://www.npmjs.com/package/connect-mongo> [express-session]:<https://www.npmjs.com/package/express-session> [passport-local]:<https://www.passportjs.org/packages/passport-local/> [uuid]:<https://www.npmjs.com/package/uuid> [nodemailer]:<https://www.npmjs.com/package/nodemailer> [express-compression]:<https://www.npmjs.com/package/express-compression> [http-status-codes]:<https://www.npmjs.com/package/http-status-codes> [winston]:<https://www.npmjs.com/package/winston> [artillery]:<https://www.npmjs.com/package/artillery> [swagger-jsdoc]:<https://www.npmjs.com/package/swagger-jsdoc> [swagger-ui-express]:<https://www.npmjs.com/package/swagger-ui-express> [supertest]:<https://www.npmjs.com/package/supertest> [chai]:<https://www.npmjs.com/package/chai> [mocha]:<https://www.npmjs.com/package/mocha>
Este repositorio contiene la implementación de una API utilizando Node.js, Express.js, MongoDB (con Mongoose) .
expressjs,javascript,mongodb,mongoose,nodejs
2023-08-04T02:24:34Z
2024-05-19T21:06:17Z
null
1
22
219
2
0
2
null
null
JavaScript
Hashuudev/Solar-Energy-Landing-Page
main
# Solar-Energy [![Netlify Status](https://api.netlify.com/api/v1/badges/5bbebd4c-026d-45c1-978a-cbaa100951dc/deploy-status)](https://app.netlify.com/sites/hashuudev-solar-site/deploys) This is a Solar Energy Introductory Web Application. <br> Here you can get every solar energy product for your home, industries and agriculture - a business build for your profitable investment. # Technology-Used * HTML * CSS * JavaScript * Bootstrap * SCSS * Php * Carousel Library # Screenshot ![smart-energy-full-page](https://github.com/Hashuudev/Solar-Energy-Landing-Page/assets/94761963/b57ca584-9136-4f32-be0e-a6b9c17ef3a4)
A Solar Energy Site deployed using SCSS, JavaScript Template. Here you can get every solar energy product for your home, industries and agriculture - a business build for your profitable investment.
beginner-project,carousel,css,event-management,front-end-development,html,intersection-observer,javascript,junior-developer,landing-page
2023-07-24T16:09:31Z
2023-08-18T20:49:02Z
null
1
0
29
0
1
2
null
null
SCSS
Basa2000/05.Counter-app
main
null
This counter app is built for practice purpose but from this basic project i have learned how to apply JavaScript on web page like fetch the value from web page and set the value.
css,html,javascript,tailwindcss
2023-07-22T14:48:08Z
2023-07-22T14:58:08Z
null
1
0
1
0
0
2
null
null
HTML
Andessonreis/AniLibrary
main
# AniLibrary - Documentação Bem-vindo à documentação do AniLibrary, o seu Catálogo de Animes interativo! # Descrição O AniLibrary é um catálogo interativo de animes desenvolvido como parte do curso de Análise e Desenvolvimento de Sistemas (ADS). Nosso objetivo é proporcionar aos usuários uma experiência de exploração agradável ao mundo dos animes, utilizando tecnologias web como HTML, CSS e JavaScript. ## Tecnologias Utilizadas O AniLibrary foi desenvolvido utilizando as seguintes tecnologias: - Front-End: - ![HTML](https://img.shields.io/badge/HTML-red?style=for-the-badge&logo=html-5&logoColor=white) - ![CSS](https://img.shields.io/badge/CSS-blue?style=for-the-badge&logo=css-3&logoColor=white) - ![JS](https://img.shields.io/badge/JavaScript-yellow?style=for-the-badge&logo=javascript&logoColor=white) - ![Vercel](https://img.shields.io/badge/Vercel-black?style=for-the-badge&logo=vercel&logoColor=white) ## Como Acessar Explore o AniLibrary e descubra uma coleção incrível de animes! 👉 **[Clique aqui para acessar o AniLibrary](https://ani-library.vercel.app/)** ## Estrutura do Projeto O projeto AniLibrary é organizado da seguinte forma: - `index.html`: Página principal do site que contém a estrutura HTML. - `styles/`: Diretório que contém os arquivos de estilo CSS. - `global.css`: Arquivo que define estilos gerais aplicados a todo o site. - `styles.css`: Arquivo para estilos específicos do projeto. - `scripts/`: Diretório que contém os arquivos JavaScript. - `main.js`: Arquivo que contém lógica JavaScript para interatividade no site. - `images/`: Diretório que armazena as imagens utilizadas no site. - `favicon.ico`: Ícone do site exibido na barra do navegador. ## Seções do Projeto O AniLibrary possui as seguintes seções: - **Animes em Destaque**: Os animes em destaque são exibidos nesta seção. - **Novos Lançamentos**: Confira os animes que acabaram de ser lançados. - **Animes Populares**: Descubra quais são os animes mais populares no momento. - **Próximos Lançamentos**: Fique por dentro dos animes que estão por vir. ## Cores e Temas O AniLibrary possui dois temas: claro e escuro. As cores utilizadas nos temas podem ser consultadas no arquivo `global.css`. ### Tema Claro: - **Cores Neon**: - Cor Primária Neon Azul Claro: `--light-primary-neon-blue` - Cor Neon para Efeito Hover: `--neon-hover` - **Cores de Fundo**: - Cor de Fundo Clara: `--background-light` - **Cores de Texto**: - Cor do Texto em Fundo Claro: `--text-light` - **Outras Cores**: - Cinza Claro: `--grey` - Cor de Aviso Clara: `--light-warning` - Cor de Alerta Clara: `--light-danger` - Cor de Sucesso Clara: `--light-success` ### Tema Escuro: - **Cores Neon**: - Cor Primária Neon Azul: `--dark-primary-neon-blue` - Cor Secundária Neon Azul: `--dark-secondary-neon-blue` - Cor Neon Verde: `--dark-neon-green` - Cor Neon Roxa: `--dark-neon-purple` - **Cores de Fundo**: - Cor de Fundo Escura: `--dark-background` - Cor de Fundo dos Cards: `--dark-card-background` - **Cores de Texto**: - Cor do Texto: `--dark-text` - **Outras Cores**: - Cinza Escuro: `--dark-grey` - Cor de Perigo Escura: `--dark-danger` - Cor de Aviso Escura: `--dark-warning` - Cor de Sucesso Escura: `--dark-success` Essas cores e temas foram selecionados para criar uma experiência visual envolvente e agradável para os usuários ao explorarem o catálogo de animes. ## Licença Este projeto está licenciado sob a Licença MIT. Consulte o arquivo [LICENSE](LICENSE) para obter mais detalhes. ## Autor Desenvolvido por Andesson Reis. <div style="display: flex; align-items: center;"> <img src="https://github.com/Andessonreis.png" alt="Andesson Reis" width="70" height="70" style="border-radius: 50%; margin-right: 10px;"> </div>
Este é um projeto desenvolvido como parte do curso de Análise e Desenvolvimento de Sistemas (ADS), na disciplina de Programação Web.
anime,css,html5,javascript,library
2023-08-08T16:13:56Z
2023-09-25T14:04:09Z
null
1
12
187
0
0
2
null
MIT
HTML
Wellington-lopes/siteMitologiaNordica
main
# siteMitologiaNordica
null
css3,git,github,html5,javascript
2023-08-06T23:16:42Z
2023-08-18T21:09:19Z
null
1
1
9
0
0
2
null
null
HTML
pradeeptosarkar/dotRead
main
<div align="center"> <h2>Show some ❤️ by starring this awesome repository!</h2> </div> ## Table of Contents - [Introduction to dotRead](#introducing-dotread) - [Demo](#live-demo) - [Part of Hacktoberfest 2023](#open-source-programs-this-repo-has-been-part-of) - [Contribution Guidelines](#contribution-guidelines) - [Local Setup](#how-to-set-up-dotread-for-development) - [GitHub Tutorial](#github-beginner-guide) ## Introducing dotRead It's a tool for reading github code in the brower using Monaco editor. It helps in skimming the codebase with ease and have features like multiple open files. ## Live Demo Here is the link for the live demo, give it a try > [dotRead](https://dotread.netlify.app/) ## Open Source programs this repo has been part of <a href="https://github.com/pradeeptosarkar/dotread"><img src="https://badges.frapsoft.com/os/v2/open-source.svg?v=103"></a> <div align="center"> <img src="https://miro.medium.com/v2/resize:fit:1400/0*McOGR_vW3LivYNor.png" width="500px"> </div> <div align="center"> <a href="https://hacktoberfest.com/">HACTOBERFEST 2023</a> </div> <br> <br> <p align="right">(<a href="#top">back to top</a>)</p> ## Contribution Guidelines Here are some set of guidelines to follow while contributing to `dotRead` : ``` 1. Welcome to this repository, if you are here as an open-source program participant/contributor. 2. Participants/contributors have to **comment** on issues they would like to work on, and mentors or the PA will assign you. 3. Issues will be assigned on a **first-come, first-serve basis.** 4. Participants/contributors can also **open their issues**, but it needs to be verified and labelled by a mentor. We respect all your contributions, whether it is an Issue or a Pull Request. 5. When you raise an issue, make sure you get it assigned to you before you start working on that project. 6. Each participant/contributor will be **assigned 1 issue (max)** at a time to work. 7. Don't create issues that are **already listed**. 8. Please don't pick up an issue already assigned to someone else. Work on the issues after it gets **assigned to you**. 9. Create your file in an appropriate folder with appropriate name and extension. 10. Pull requests will be merged after being **reviewed** by maintainers5. 11. We all are here to learn. You are allowed to make mistakes. That's how you learn, right!. ``` ### How to Contribute: - Before Contribute Please read [CONTRIBUTING.md](https://https://github.com/pradeeptosarkar/dotRead/blob/master/CONTRIBUTING.md) and [CODE_OF_CONDUCT.md](https://https://github.com/pradeeptosarkar/dotRead/blob/master/CODE_OF_CONDUCT.md) - Fork the repo to your Github.<br/> - Clone the Forked Repository to your local machine. ``` git clone https://github.com/<username>/dotread. ``` - Change the directory to dotRead. ```bash cd dotread ``` - Add remote to the Original Repository. ``` git remote add upstream https://https://github.com/pradeeptosarkar/dotRead ``` - Check the remotes for this repository. ``` git remote -v ``` - Always take a pull from the upstream repository to your master branch to keep it at par with the main project(updated repository). ``` git pull upstream main ``` - Create a new branch. ``` git checkout -b <your_branch_name> ``` - Perform your desired changes to the code base. - Track your changes:heavy_check_mark: . ``` git add . ``` - Commit your changes . ``` git commit -m "Relevant message" ``` - Push the committed changes in your feature branch to your remote repo. ``` git push -u origin <your_branch_name> ``` - To create a pull request, click on `compare and pull requests`. Please ensure you compare your feature branch to the desired branch of the repository you are supposed to make a PR to. - Add appropriate title and description to your pull request explaining your changes and efforts done. - Click on `Create Pull Request`. - Voila! You have made a PR to this repo. Sit back patiently and relax while your PR is reviewed <p align="right">(<a href="#top">back to top</a>)</p> <!-- ------------------------------------------------------------------------------------------------------------------------------------------------------------- --> ### Install dependencies ``` cd dotread npm install npm start ``` <p align="right">(<a href="#top">back to top</a>)</p> <!-- ------------------------------------------------------------------------------------------------------------------------------------------------------------- --> ## How to Set up `dotRead` for Development? ### 🍴 Fork and Clone the Repo First, you need to fork the `dotRead` repo. You can do this by clicking the `Fork` button on the top right corner of the repo. If you are new to forking, please watch this [YouTube Guide](https://www.youtube.com/watch?v=h8suY-Osn8Q) to get started. Once forked, you can clone the repo by clicking the `Clone or Download` button on the top right corner of the forked repo. Please change the directory after cloning the repository using the `cd <folder-name>` command. > **Note:** Create a `.env.local` file and Copy all the contents of `.env.example` and paste into `.env.local` file that you created.After that update your `env variable` like `VITE_GITHUB_TOKEN`. If you don't know how to get token follow this [article](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens). ### Install Dependencies Next, install the dependencies by running the following command in the `dotRead` repo. we recommend using `yarn` but you can install using `npm` too ```bash yarn install ``` Or ``` npm install ``` if you don't have `yarn` installed on your PC, follow the steps below to install it.. **Windows** 1. open your command prompt as administrator. 2. write `corepack enable` and hit enter. 3. then `npm install --global yarn` **Linux** 1. open terminal and hit `npm install --global yarn` **MacOS** 1. open terminal and hit `npm install --global yarn` or `brew install yarn` **Or Download Package** If you are unable to install yarn following the above-mentioned process, then you can simply download the package and install it. Visit the official website of Yarn; there you can just expand the "Alternative" section and it will ask for the version to download for Windows, Linux, or Mac. `https://classic.yarnpkg.com/en/docs/install#windows-stable` > **Note**: `dotRead` runs on React 18. However, some of the dependencies are yet to upgrade to version 18. So please use the following command when you face difficulties installing the dependencies. Also, ensure to use Node.js version >= 16.x ### Start the Development Mode Use the following command to start the app in the development mode: ```bash yarn run dev ``` or if you installed dependencies using `npm` use below command ``` npm run dev ``` It runs the app in development mode. Open [http://localhost:5173](http://localhost:5173) to view it in your browser. The page will reload when you make changes. ## Github Beginner Guide #### Are you a beginner in using Github? You can refer to the following articles on the basics of Git and Github and also contact me, in case you are stuck: - [Forking a Repo](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) - [Cloning a Repo](https://help.github.com/en/desktop/contributing-to-projects/creating-an-issue-or-pull-request) - [How to create a Pull Request](https://opensource.com/article/19/7/create-pull-request-github) - [Getting started with Git and GitHub](https://towardsdatascience.com/getting-started-with-git-and-github-6fcd0f2d4ac6) - [Learn GitHub from Scratch](https://lab.github.com/githubtraining/introduction-to-github) <p align="right">(<a href="#top">back to top</a>)</p> <!-- ------------------------------------------------------------------------------------------------------------------------------------------------------------------ -->
null
github-api,javascript,reactjs,hacktoberfest,hacktoberfest-accepted,hacktoberfest2023
2023-07-30T04:47:33Z
2023-10-04T13:01:24Z
null
3
2
35
0
0
2
null
MIT
JavaScript
1ashutoshverma/bewakoof-clone
main
# bewakoof-clone Founded in 2012, Bewakoof is a lifestyle fashion brand that makes creative and top-notch apparel for trendy, contemporary Indians. Bewakoof was launched on the principle of creating impact through innovation, honesty, and thoughtfulness. It has become one of the most sought-after fashion brands of this generation. The lifestyle brand has created a new niche in the fashion and apparel market with its innovative and interesting, ideas and captivating catalog. Bewakoof is hands down amazing when it comes to creating light-hearted, fun, and quirky everyday outfits and other products (like mobile covers). Bewakoof quotes are some of the most intriguing things that the company offers along with its merchandise. Furthermore, the Bewakoof shirts and t shirts and other Bewakoof.com products are available at pocket-friendly prices. Moreover, its unique name is enough to turn heads. Bewakoof.com, which sells apparel and mobile phone covers, is better known for creating head-turning catalogs like its ‘Ghanta’ collection of t-shirts for college students with messages like ‘Ghanta Engineering/Ghanta MBA’; the collection was a big hit and was tagged as 'best-seller' by the company. Bewakoof primarily caters to the age group of 16-34 years. ![Screenshot (525)](https://user-images.githubusercontent.com/101390725/191264154-7c99b1d0-f5c2-496c-bb80-bb2b569a18ee.png) How to use our website for online shopping-: Steps 1.Login and sign Up- User have to login first. we have provided some features like mobile Number, E-mail, Google account so that user can login to our website by using anyone of them. ![Screenshot (524)](https://user-images.githubusercontent.com/101390725/191264392-d47bfad9-3c46-4d01-bf18-af39fb8c349a.png) 2.Search Products - User can search any products of his or her choice by searching on the search option which is availabe on our websites Naviagation bar. 3.Multiple choices - We have provided multiple options like Mens section, women sections and accessories sections for our users so that they can get there products with ease. 4.Product Page - By clicking on the any of the above sections user will lands on Product page of the our website. Here we have provided some filter features so that user can filter his or her products from high prices to low prices and vice-versa. ![Screenshot (526)](https://user-images.githubusercontent.com/101390725/191264553-66ffa0cf-fb45-4748-8100-8276204ef44c.png) 5.Display page - After clicking on the particular product from product page. user will lands on Display page where user can see the details of the product, from there user can wishlist his or her product by their choices, and also can select the size of the products. And user wants to buy then user first have add the particular product to the cart. ![Screenshot (527)](https://user-images.githubusercontent.com/101390725/191264656-8338a764-1967-47ea-8244-35763c63f2f1.png) 6.Cart page - In this page user can reselect size of his or her product, and also can increase the quantity of the product. In this page also user can see the payable ammount, and discount user has got by buying the particular product. And after clicking on the "Continue" button user will lands on Payment page. ![Screenshot (528)](https://user-images.githubusercontent.com/101390725/191264751-5594c3b3-52cb-40fe-86cf-f67f11a60a06.png) 7.Payment page - We have provided multiple options to the users so that they can make payment for their product by selecting anyone of the options. ![Screenshot (529)](https://user-images.githubusercontent.com/101390725/191264857-155211bb-7967-4e51-babf-52cb3c7930f4.png) 8.Delivery Day - In this section we are giving date to the users within these days user will get their product at their doorstep. 9.Pay Now - After clicking on the pay now then user will confirmation for their payment. We will feel happy to hear you !
Bewakoof.com is an Indian e-commerce platform known for its trendy and quirky fashion, offering a wide range of casual clothing, accessories, and merchandise. With a playful and youthful style, it caters to individuals looking for unique and fun apparel choices.
css,html,javascript
2023-08-06T09:32:24Z
2023-12-16T15:14:42Z
null
3
7
47
0
2
2
null
null
HTML
Centaurus-X/FluxChem-Interface
main
# Automation of a chemical process using a web interface & python server application This python server program allows to control a fieldbus controller via websocket (simplewebsocketserver), a mysql database connection is used for further state storage. The communication with the fieldbus controller runs over modbus tcp, for this the pymodbus library is used. This allows remote control and configuration of a system via the web browser. ## ![Screenshot](https://github.com/Centaurus-X/automatization_web_api_python/assets/141531206/d21cf8b5-30e4-412d-b161-912e9332d537) <meta name="google-site-verification" content="wWXBoPBgsyesGIWnaHmcu3RLDOQZCh06if25r_USuIo" />
Automation of a chemical process using a web interface
automation,chemical-engineering,chemistry,control-systems,css,database,html,javascript,modbus-tcp,plc
2023-08-05T23:52:40Z
2023-12-23T23:11:25Z
null
1
0
39
0
1
2
null
MIT
Python
Thorus-Slughorm/idCardGenerator
main
# idCardGenerator "Delighted to showcase my newest creation: a dynamic college ID card generator! Leveraging the power of HTML, CSS, and JavaScript, this tool streamlines student identification, making it efficient and hassle-free. Empowering colleges to produce professional-looking ID cards tailored to their unique needs. #webdevelopment #javascript #collegeID" "Introducing my innovative college ID card generator, a product of passion and skill in web development. With a focus on user-friendly design, this feature-rich tool allows administrators to effortlessly create customized ID cards for students, faculty, and staff. The seamless integration of HTML, CSS, and JavaScript ensures a smooth and intuitive experience, enabling colleges to streamline their identification processes. Embracing flexibility, the generator accommodates various card layouts, color schemes, and QR code options for enhanced functionality. Simplifying identification management, this project brings efficiency and professionalism to college campuses. Join me in revolutionizing the college ID card system! #webdevelopment #javascript #collegeID #innovation"
"Delighted to showcase my newest creation: a dynamic college ID card generator! Leveraging the power of HTML, CSS, and JavaScript, this tool streamlines student identification, making it efficient and hassle-free. Empowering colleges to produce professional-looking ID cards tailored to their unique needs. #webdevelopment #javascript #collegeID"
css,devops,html,javascript,project,web,website,idcard-check,idcard-generator
2023-07-28T14:40:41Z
2023-07-28T14:49:54Z
null
1
0
2
0
0
2
null
null
CSS
casdoor/casdoor-nodejs-angular-example
master
<h1 align="center" style="border-bottom: none;">Casdoor nodejs-angular Example</h1> ## Demo ![angular-illustration.gif](demo.gif) ## Architecture The example includes two parts: | Name | SDK | Framework | Source code | |----------|---------------------|------------|-------------------------------------------------------------------| | Frontend | casdoor-angular-sdk | Angular | https://github.com/casdoor/casdoor-nodejs-angular-example/tree/master/web | | Backend | casdoor-nodejs-sdk | Express.js | https://github.com/casdoor/casdoor-nodejs-angular-example/tree/master/backend | ## Installation Example uses Casdoor to manage members. So you need to create an organization and an application for the example in a Casdoor instance. ### Necessary Configurations #### Get the Code ```shell git clone https://github.com/casdoor/casdoor git clone https://github.com/casdoor/casdoor-nodejs-angular-example ``` #### Run Example 1. Run Casdoor 2. Configure - Backend - Frontend #### Backend Config Initialization requires 6 (or 5) parameters, which are all string type. Please refer to the official doc on [backend sdk configuration](https://casdoor.org/docs/how-to-connect/sdk#1-backend-sdk-configuration) for the latest change. | Parameter | Must | Description | |------------------|------|--------------------------------------------------------------------------------| | endpoint | Yes | Casdoor Server URL, like `https://door.casdoor.com` or `http://localhost:8000` | | clientId | Yes | Client ID for the Casdoor application | | clientSecret | Yes | Client secret for the Casdoor application | | jwtPublicKey | Yes | The public key for the Casdoor application's cert | | organizationName | Yes | The name for the Casdoor organization | | applicationName | No | The name for the Casdoor application | ```js // in ./backend/server.js const authCfg = { endpoint: 'https://door.casdoor.com', clientId: '014ae4bd048734ca2dea', clientSecret: 'f26a4115725867b7bb7b668c81e1f8f7fae1544d', certificate: cert, orgName: 'casbin', appName: 'app-casnode', } ``` #### Frontend The first 4 parameters should use the same value as the Casdoor backend SDK. The last parameter redirectPath is relative path for the redirected URL, returned from Casdoor's login page. Please refer to the official doc on [frontend sdk configuration](https://casdoor.org/docs/how-to-connect/sdk#2-frontend-configuration) for the latest change. ```js // in ./src/Setting.js const config = { serverUrl: "https://door.casdoor.com", clientId: "014ae4bd048734ca2dea", organizationName: "casbin", appName: "app-casnode", redirectPath: "/callback", }; ``` Fetch dependencies: ```shell cd web npm install ``` Run frontend at: http://localhost:9000 ```shell ng serve --port 9000 ``` ### Backend Fetch dependencies: ```shell yarn install ``` Run backend at: http://localhost:8080 ```shell node server.js ```
Node.js Express + Angular example app for Casdoor based on casdoor-nodejs-sdk and casdoor-js-sdk
angular,casdoor,example,js,express,iam,javascript,node,nodejs,oauth
2023-07-24T03:54:33Z
2023-08-08T05:47:39Z
null
13
3
11
0
2
2
null
Apache-2.0
TypeScript
JustLittleFox/Odemliuk-Front-end-Pro-08-04-2023
main
null
add the folder name to the end of link below (needs for github-pages)
ajax,dom,es6,git,javascript,jquery,mongodb,react
2023-08-04T12:36:29Z
2024-04-13T12:18:09Z
null
1
0
74
0
0
2
null
null
JavaScript
Adidem23/AiB
master
<div align="center"> <img src="https://github.com/Adidem23/AiB/assets/124609794/8a564ba3-1e2f-4b80-be28-aadb0a408e30" style="border-radius:30px;" /> <h3 align="center">AiB: AI NFT Generator</h3> </div> <div align="center"> ![Contributors](https://img.shields.io/github/contributors/Adidem23/AiB?color=dark-green) ![Forks](https://img.shields.io/github/forks/Adidem23/AiB?style=social) ![Stargazers](https://img.shields.io/github/stars/Adidem23/AiB?style=social) ![Issues](https://img.shields.io/github/issues/Adidem23/AiB) </div> <details> <summary>Table of Contents</summary> <ol> <li> <a href="#about-the-project">About The Project</a> <ul> <li><a href="#built-with">Built With</a></li> </ul> </li> <li> <a href="#getting-started">Getting Started</a> <ul> <li><a href="#prerequisites">Prerequisites</a></li> <li><a href="#installation">Installation</a></li> </ul> </li> <li><a href="#usage">Usage</a></li> </ol> </details> <!-- ABOUT THE PROJECT --> ## About The Project The AI NFT Generator Project is not just about the fusion of AI and NFTs; it represents a shift in the art and technology landscape, where creativity and innovation are boundless. As the project continues to evolve, it promises to reshape how we perceive, create, and trade art in the digital age, making art more accessible and collectible than ever before. ### Built With I have Built This Project Using Following Tech Stack mentioned below - [![My Skills](https://skillicons.dev/icons?i=react&perline=3)](https://skillicons.dev) ReactJs - [![My Skills](https://skillicons.dev/icons?i=solidity&perline=3)](https://skillicons.dev) solidity - [![My Skills](https://skillicons.dev/icons?i=javascript&perline=3)](https://skillicons.dev) JavaScript - For Genration of Image from User Prompt Input I have used Stable Diffusion Model from Hugging Face - For Miniting and NFT Minting I have used ThirdwebSDk for that purpose <!-- GETTING STARTED --> ### Prerequisites This is an example of how to list things you need to use the software and how to install them. * npm ```sh npm install npm@latest -g ``` * NodeJs ```sh Download Nodejs Version ^ 17.0.0 LTS ``` * You must Have Metamask Installed on system and You Must Have Polygon-mumbai matic tokens For transactions * You must Have Thirdweb Account For That ### Installation Follow The Installation manual and install dependencies 1.Clone this repo and Fork AiB 2.Install NPM Modules ```sh npm install --force ``` 3.Run Frontend ```js cd src npm run start ``` 4.Open Metamask and Mint NFTs !! 😎 ## Output and Screenshots and Video Output : - FrontPage : ![image](https://github.com/Adidem23/AiB/assets/124609794/6847ba27-4e86-4da3-9b24-9c05b852aca1) - MintPage : ![image](https://github.com/Adidem23/AiB/assets/124609794/e0b77ae8-8804-402b-8674-5c3fa7919c31) - Genearted Image : ![image](https://github.com/Adidem23/AiB/assets/124609794/3c6b4325-e7fa-4a76-ae2b-502e038b3276) - Minted NFT : ![image](https://github.com/Adidem23/AiB/assets/124609794/adaef021-5db8-4e00-9e47-57cf087ec4fa) - Video Output of Code : https://www.loom.com/share/87013f63230e4d0aabe70a637c99db42?sid=b230e656-7912-4c9a-8e13-dd8c7ab778f9 ## Deployment Links : - Thirdweb Smart Contract Link : https://thirdweb.com/mumbai/0x7bBa929Fd6c5b3aaf8a839724c48ab081f32a7c6 - Vercel Deployed Link : https://adityaainft.vercel.app/ - Fleek Deployed Link : https://lingering-cherry-6342.on.fleek.co/
This is AI-NFT-Minter Application which generates Images from users Description and Mint them as NFT
erc721,huggingface,javascript,mern-stack,metamask,nft,reactjs,stable-diffusion,thirdweb
2023-08-08T12:22:17Z
2024-01-01T16:12:25Z
null
2
0
27
0
1
2
null
null
JavaScript
TonyHansord/SalesPick
main
#SalesPick ## Description ## Log In Details ### Admin Username: gjones Password: admin ### Sales ```
Inventory and Warehouse Management App
javascript,react,ruby-on-rails
2023-08-05T00:45:42Z
2024-04-29T11:10:46Z
null
3
0
70
0
0
2
null
NOASSERTION
JavaScript
Prathamrai999/online-co-work-creator-platform
master
null
A platform for creators mainly catering to content creators like YouTubers and bloggers. It offers a multifaceted approach by enabling content upload, traffic generation, and revenue opportunities through referral programs and engagement with fellow creators' content.
css,html,javascript,mysql-database,php,phpmailer-library,razorpay-api,tawkto,youtube-api
2023-07-30T14:56:16Z
2023-07-30T15:26:16Z
null
1
0
1
0
0
2
null
null
null
wajeht/type
main
# ⚡️ Type [![Node.js CI](https://github.com/wajeht/type/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/wajeht/type/actions/workflows/ci.yml) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/wajeht/type/blob/main/LICENSE) [![Open Source Love svg1](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://github.com/wajeht/type) real time javascript code editor with vim motion # 📚 Technologies - [Node.js](https://nodejs.org/en/) - JavaScript runtime - [Express](https://expressjs.com/) - Web framework - [Socket.io](https://socket.io/) - Realtime application framework - [CodeMirror](https://codemirror.net/) - Code editor # 💻 Development Clone the repository ```bash $ git clone https://github.com/wajeht/type.git ``` Copy `.env.example` to `.env` ```bash $ cp .env.example .env ``` Install dependencies ```bash $ npm install ``` Run development server ```bash $ npm run dev ``` Test the application ```bash $ npm run test ``` # © License Distributed under the MIT license © wajeht. See LICENSE for more information.
real time javascript code editor with vim motion
codemirror,javascript,socketio,websocket
2023-08-03T07:21:58Z
2024-04-28T00:54:03Z
null
1
18
93
3
0
2
null
MIT
TypeScript
pronoia9/weavio
main
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). ## Getting Started First, run the development server: ```bash npm run dev # or yarn dev # or pnpm dev ``` Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. ## Learn More To learn more about Next.js, take a look at the following resources: - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! ## Deploy on Vercel The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
Dive into meaningful discussions and trendsetting ideas with Weavio, your digital hub for vibrant conversations. Inspired by Threads, Weavio offers a dynamic platform where users engage, inspire, and connect.
autoprefixer,clerk,clsx,css,html,javascript,mongodb,mongoose,nextjs,postcss
2023-08-05T18:39:00Z
2023-08-12T18:46:04Z
null
1
0
118
1
0
2
null
null
TypeScript
Basa2000/06.Profile-Modal
main
null
The Profile modal basically represents the my profiles and role also it helps to reach out to me.
css,html,javascript,profiler,responsive-design,social-network
2023-07-22T15:10:20Z
2023-07-22T15:09:43Z
null
1
0
1
0
0
2
null
null
CSS
ViktorSvertoka/react-working-with-forms
main
# Getting Started with Create React App This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). ## Available Scripts In the project directory, you can run: ### `npm start` Runs the app in the development mode.\ Open [http://localhost:3000](http://localhost:3000) to view it in your browser. The page will reload when you make changes.\ You may also see any lint errors in the console. ### `npm test` Launches the test runner in the interactive watch mode.\ See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. ### `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](https://facebook.github.io/create-react-app/docs/deployment) for more information. ### `npm run eject` **Note: this is a one-way operation. Once you `eject`, you can't go back!** If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. ## Learn More You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). To learn React, check out the [React documentation](https://reactjs.org/). ### Code Splitting This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) ### Analyzing the Bundle Size This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) ### Making a Progressive Web App This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) ### Advanced Configuration This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) ### Deployment This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) ### `npm run build` fails to minify This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
My react practice ✍️
css3,gitignore,html5,javascript,jsconfig,json,npm,prettier,react,readme
2023-07-23T16:24:53Z
2023-07-23T18:25:59Z
null
1
0
2
0
0
2
null
null
JavaScript
fifolio/Intellivox
main
# Intellivox #### Project current stage - 👨‍💻 Development #### Next Stage - ⏳ Designing #### Upcoming stages - ⏳ Test beta - ⏳ Production - ⏳ Test version 1.0.0 - ⏳ Release v1.0.0 # ### Project Overview: Voxia - An AI Assistant powered by ChatGPT 🤖 Voxia is an AI assistant designed to gather information using natural language processing and powered by the ChatGPT language model. The primary objective of Voxia is to provide users with a seamless conversational experience where they can interact with the AI using voice commands to obtain information on various topics. Voxia will be developed as a web application with a React frontend and a backend built using Strapi & Node/Express. The front end will enable users to communicate with Voxia through a simple and intuitive interface, while the back end will handle processing the user's input and generating responses using the ChatGPT API. **Project Core Name: Intellivox** 1. **Intelli:** Derived from "intelligent," which signifies the AI assistant's capability to understand, learn, and adapt based on user interactions. It conveys the essence of artificial intelligence and the ability to make smart decisions. 2. **Vox:** As mentioned before, "vox" means "voice" or "sound" in Latin. The inclusion of "vox" in the name indicates that the AI assistant has voice-based interaction capabilities, just like other popular AI assistants (e.g., Google Assistant, Amazon Echo). Combined, "Intellivox" suggests an intelligent AI assistant that excels in voice-based interactions and can understand and respond to users' needs and commands. It conveys a sense of cutting-edge technology and advanced artificial intelligence, making it an engaging and appropriate name for the project. "Intellivox" has a modern and catchy ring to it, which can help create a memorable brand identity for your AI assistant. As with any name, its significance will be shaped by the context and perception associated with the product it represents. Overall, "Intellivox" presents a strong and compelling image for an AI assistant project with a focus on intelligence and voice interaction. **Project Alt. Name: Voxia** "Voxia" is derived from the Latin word "vox," which means "voice" or "sound." It is common for AI assistants to be voice-activated, responding to spoken commands or queries from users. Therefore, the name "Voxia" could be associated with the AI's ability to interact through voice commands, making it an appropriate and suggestive name for your voice-controlled AI assistant. Additionally, the name "Voxia" sounds modern and technological, which aligns well with the idea of an advanced AI assistant. The name also has a sense of sophistication and elegance, which can help create a positive impression for users interacting with the AI assistant. Remember, the meaning and significance of a name can often be shaped by the context and perception associated with the product or service it represents. "Voxia" has the potential to evoke a sense of advanced voice-based technology, making it a suitable choice for an AI assistant with voice interaction capabilities. <img src="https://cdn.dribbble.com/users/1259682/screenshots/16962880/media/6734356060129abb881da81f043846f4.gif" width="100%" height="100%" /> **Project Goals 🎯** - Develop an AI assistant capable of understanding and processing natural language queries. - Provide an interactive and user-friendly interface for communication. - Integrate speech-to-text and text-to-speech capabilities to enable voice interactions. - Use the ChatGPT API to generate appropriate responses to user queries. - Ensure data privacy and security by following best practices. **Technology Stack 🛠️** - Frontend: ReactJS - A popular JavaScript library for building user interfaces. - Backend Option 1: Strapi - A headless CMS (Content Management System) based on Node.js. - Backend Option 2: Node.js/Express - A robust and widely used web application framework for Node.js. - Speech-to-Text: A JavaScript library (e.g., Web Speech API) to convert speech to text. - Text-to-Speech: A JavaScript library (e.g., Web Speech API) to convert text to speech. - ChatGPT API: The OpenAI GPT-3.5 language model API to generate responses. ### User Workflow 🚀 <img src="https://assets-global.website-files.com/59e16042ec229e00016d3a66/60b8f05f56dde86d8d147355_blog-hero_document-workflow.gif" width="100%" height="100%" /> The user workflow of Voxia, the AI assistant powered by ChatGPT, has been thoughtfully designed to deliver a seamless and engaging conversational experience for users. When interacting with Voxia, users have the option to communicate using voice commands for their queries in the frontend interface. - **🗣️ User Interaction**: To begin the interaction, users can simply speak their queries or type them using the keyboard. This flexibility allows users to choose their preferred mode of communication, making Voxia accessible to a wide range of users. - **🎙️ Speech-to-Text Conversion**: For users opting for voice interaction, the speech-to-text library steps in to convert their spoken words into text format. This process ensures that the AI assistant can process and understand the user's input accurately. - **📡 Request Handling**: Once the text input is obtained, it is sent to the backend server for further processing. The backend, built with either Strapi or Node/Express, prepares the user's query to be processed by the powerful ChatGPT API. - **🤖 Interaction with ChatGPT**: The backend facilitates seamless interaction with the ChatGPT API, which is a cutting-edge language model capable of understanding natural language queries. The AI processes the user's input and generates a relevant and contextually appropriate response. - **📢 Text-to-Speech Conversion**: After receiving the response from the ChatGPT API, the backend sends it back to the frontend. For users who prefer voice interaction, the text-to-speech library converts the response text into a speech format. This ensures that users receive the information in a natural and conversational manner. - **🎤 Response to User**: The generated response is then presented to the user through the frontend interface. Users can see the response on the screen or hear it as voice output, depending on their chosen mode of interaction. ### Data Privacy and Security 🔒 <img src="https://stemettes.org/zine/wp-content/uploads/sites/3/2021/09/13d79c62-bf64-42a5-b1e0-3bba1acf8f9b_rw_1200.gif" width="100%" height="100%" /> Ensuring data privacy and security is of utmost importance for Voxia. The following measures will be implemented to protect user data and maintain a secure environment: - **Encryption (🔒)**: All communication between the frontend and backend will be encrypted using HTTPS, safeguarding user inputs and responses from unauthorized access. - **Authentication and Authorization (🔐)**: API keys or access tokens will be used for authentication and authorization purposes. This ensures that only authorized users can interact with Voxia and access its functionalities. - **Input Validation (✅)**: Robust input validation and sanitization techniques will be employed to prevent injection attacks and data manipulation. - **Minimal Data Storage (🚫)**: Voxia will avoid storing unnecessary user data. User inputs will be processed and discarded promptly, reducing the risk of data breaches. - **Data Access Controls (🔒)**: Strict access controls will be enforced to limit access to user data. Only authorized personnel will be able to access sensitive information, ensuring confidentiality. - **Regular Security Audits (🕵️‍♂️)**: Periodic security audits will be conducted to identify potential vulnerabilities and address them proactively. - **Dependencies Management (🔄)**: Regular updates and monitoring of dependencies will be performed to mitigate security risks associated with outdated libraries or frameworks. - **Privacy Policy (📜)**: A comprehensive privacy policy will be provided to users, outlining the type of data collected, its usage, and how it will be protected. - **User Consent (✅)**: Users will be informed about data collection and processing practices, and their explicit consent will be obtained before interacting with Voxia ### Challenges and Mitigations 🛡️🛠️ <img src="https://thumbs.gfycat.com/OldSadAmericanlobster-max-1mb.gif" width="100%" height="100%" /> - **Natural Language Understanding:** Training an AI assistant like Voxia to effectively understand and process a wide range of user queries can be a significant challenge. Continuous fine-tuning of the ChatGPT model and incorporating user feedback will be crucial to improve its accuracy and responsiveness over time. - **Data Privacy:** With the collection of user inputs and queries, there's a potential risk of inadvertently sharing sensitive information. By adhering to strong data privacy measures (as outlined in Section 6), Voxia can minimize the possibility of data leaks and unauthorized access. - **Cost Management:** Utilizing the ChatGPT API may involve associated costs. To manage expenses effectively, monitoring usage and optimizing API calls will be essential. Additionally, exploring caching mechanisms and intelligent response handling can help reduce the number of API calls. - **Scalability (🚀):** As the user base of Voxia grows, ensuring the system's scalability becomes critical. Adopting scalable cloud infrastructure and optimizing backend processes will help handle increasing user demands efficiently. - **User Feedback Incorporation (💬):** Improving Voxia's performance and user satisfaction requires the incorporation of valuable user feedback. A dedicated feedback mechanism and data analytics will be essential to gather insights and enhance the AI assistant continually. - **Language and Cultural Sensitivity (🌍):** Voxia should be sensitive to diverse languages and cultures to provide an inclusive user experience. Extensive testing and incorporating language-specific datasets can aid in improving Voxia's cross-cultural capabilities. - **Response Generation Control (⚙️):** While Voxia is designed to provide informative responses, there might be instances where it generates inappropriate or biased content. Implementing response moderation mechanisms and ethical AI guidelines can mitigate such issues. - **Integration and Deployment (🔗):** Integrating various components and deploying Voxia in different environments can pose technical challenges. Automation and robust deployment strategies will ensure a smooth and consistent deployment process. By being aware of these potential challenges and proactively implementing suitable mitigations, the Voxia team can build a robust and reliable AI assistant that meets user expectations and delivers a delightful experience. 🛡️🛠️🚀💬 ## Conclusion 🎉🤖 Voxia, the AI assistant powered by ChatGPT, is poised to revolutionize the way users gather information and interact with technology. By utilizing cutting-edge technologies, maintaining stringent data privacy, and actively addressing potential challenges, Voxia will stand as a sophisticated AI assistant capable of providing valuable insights to its users. With continuous improvements and user engagement, Voxia will undoubtedly become a powerful and cherished addition to the realm of AI assistants. 🎉🤖🚀 *Note: As technology continues to advance, the Voxia team should remain attentive to emerging trends and embrace opportunities to enhance the AI assistant's capabilities and user experience.* 🔮💡 ## #### Follow me on Linkedin for daily updates or if you have any questions and suggestions: [@fifolio](https://www.linkedin.com/in/fifolio/) #### Keep up with the latest updates of the Interllivox Project here: [Read Updates](https://www.linkedin.com/feed/hashtag/?keywords=intellivoxproject)
👨‍💻 Development ...
ai,alan,alan-ai,api,artificial-intelligence,axios,javascript,react,restful,typescript
2023-07-23T07:50:02Z
2023-11-07T07:34:03Z
null
1
0
165
0
1
2
null
null
JavaScript
eman289/smart-login-system
master
# Project Name: Simple Login System ## Description This project is a simple login system implemented using JavaScript. It consists of three pages: a signup page, a sign-in page, and a home page that displays a personalized welcome message for the user. The signup page allows users to create an account by providing their name, email, and password. The entered information is validated, and upon successful signup, the user's data is stored locally. The sign-in page verifies user credentials against the stored account information. If the provided email and password match an existing user, the user is directed to the home page. The home page displays a welcome message using the user's name retrieved from local storage. Users can also log out from the home page, which redirects them to the sign-in page. ## Technologies Used - HTML - CSS - JavaScript ## Project Structure The project consists of the following files: 1. `index.html`: The main entry point for the sign-in page. 2. `signup.html`: Page for user registration. 3. `home.html`: Page displaying the welcome message for authenticated users. ## Usage 1. Click the "Sign Up" link on the sign-in page to access the registration page. 2. Fill out the registration form and click "Sign Up" to create an account. 3. Click the "Log in" link to access the sign-in page. 4. Use the email and password you used to log in. 5. After logging in, you'll be redirected to the home page, where your name will be displayed in the welcome message. 6. Click the "Log Out" button on the home page to log out and return to the sign-in page. ## GitHub Pages The project is hosted on GitHub Pages. You can access it [here](https://eman289.github.io/smart-login-system/). ## Note This project's functionality is basic and might not cover all security and validation aspects required for a production-level application. It's recommended to enhance security measures and error handling for a real-world deployment.
A simple login system using JavaScript
bootstrap,css3,html5,javascript
2023-07-24T01:32:03Z
2023-09-25T19:22:46Z
null
1
0
6
0
4
2
null
null
HTML
otahina/Travel-Tracker-FullStack-Project
main
![world-map-app-banner](https://github.com/otahina/Travel-Tracker-FullStack-Project/assets/108225969/3834813c-61cf-42ac-8220-83ecbf732785) ## GlobeMarks is a web application that allows users to log in, visually explore a map of the world, and mark the countries they have visited. Using this app, user can create a personalized record of their journeys. All marked countries can be saved, and the data is securely stored in the database, offering users an engaging way to reflect on their global adventures. ## Demo Highlights 🎬 https://github.com/otahina/Travel-Tracker-FullStack-Project/assets/108225969/4dc81ec8-5cfd-43cb-8531-58f54e8d70e1 ## Features 🌍 * **Interactive Global Map**: Navigate a visual map of the world, zooming in and out to explore various regions. * **Personalized Country Marking**: Click and mark the countries you've visited, creating a unique travel footprint. * **Dynamic Journey Visualization**: See your travel history come to life as countries fill with color, reflecting your personal journey. * **User Account Management**: Register, log in, and manage your travel marks across different devices. * **Data Persistence**: Save your marked countries securely in the database, allowing you to revisit your travel history anytime. ## Technologies 🛠️ ### 🌐 Interactive Mapping with Leaflet and GeoJSON **GlobeMarks** takes the art of interactive mapping to the next level using the powerful combination of **Leaflet** and **GeoJSON**. * **Leaflet 🍃**: **Leaflet** is the leading open-source JavaScript library for interactive maps. By integrating it into **GlobeMarks**, we bring you a fast, intuitive, and efficient mapping experience * **GeoJSON 🌍**: **GeoJSON** is a format for encoding a variety of geographic data structures. At its core, **GlobeMarks** uses GeoJSON to represent the shapes and boundaries of countries. This ensures precision and accuracy when you mark the countries you've visited. * **Together, A Perfect Pair 🌟** The fusion of **Leaflet**'s interactive capabilities with **GeoJSON**'s data representation gives users of **GlobeMarks** a rich and immersive experience. Navigate the globe, zoom into regions, and mark countries with confidence knowing you're backed by some of the best tools in the world of web mapping. ### Frontend ![React](https://img.shields.io/badge/React-20232A?style=for-the-badge&logo=react&logoColor=61DAFB) ![JavaScript](https://img.shields.io/badge/JavaScript-F7DF1E?style=for-the-badge&logo=javascript&logoColor=black) * **React**: Used for building the user interface, including components like the interactive map. * **JavaScript**: A programming language used in web development, especially in the creation of interactive effects within web browsers. ### Backend ![Django](https://img.shields.io/badge/Django-092E20?style=for-the-badge&logo=django&logoColor=white) ![Python](https://img.shields.io/badge/Python-3776AB?style=for-the-badge&logo=python&logoColor=white) ![PostgreSQL](https://img.shields.io/badge/PostgreSQL-316192?style=for-the-badge&logo=postgresql&logoColor=white) * **Django**: A high-level Python Web framework that encourages rapid development and clean, pragmatic design. * **Python**: A programming language known for its readability and versatility. * **PostgreSQL**: The database system used for storing user data and travel marks securely. ### Version Control ![Git](https://img.shields.io/badge/Git-F05032?style=for-the-badge&logo=git&logoColor=white) ![GitHub](https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white) * **Git**: Used for version control, allowing for efficient collaboration and change tracking. * **GitHub**: Platform for hosting the codebase and managing collaboration. ## How to use this project on your local machine 🩵 ### Step 1: Download the Code **Option 1: Clone the Repository (For Using & Experimenting)** ```bash git clone https://github.com/otahina/Travel-Tracker-FullStack-Project.git ``` **Option 2: Fork the Repository (For Contributing)** 1. Click on the "Fork" button at the top-right corner of this page. 2. Once the repository is forked, you can clone it to your local machine: ## Step 2: Create a Virtual Environment (Optional but Recommended) For windows ``` python -m venv myenv .\myenv\Scripts\activate ``` For macOS and Linux ``` python3 -m venv myenv source myenv/bin/activate ``` ### Step 3: Install Python dependencies ``` cd world_map_app pip install -r requirements.txt ``` ### Step 4: Install Node Modules for React ``` cd world_map_app/frontend npm install ``` ### Step 5: PostgreSQL Database Configuration 🐘 **This project is using** ![PostgreSQL](https://img.shields.io/badge/PostgreSQL-316192?style=for-the-badge&logo=postgresql&logoColor=white) for database Before running the project, you need to set up a PostgreSQL database and configure the `.env` file. #### On Windows: 1. Download the installer from [PostgreSQL Official Site](https://www.postgresql.org/download/windows/). 2. Run the installer and follow the instructions. #### On Mac: You can use Homebrew: ``` brew install postgresql brew services start postgresql ``` 3. Open the command-line tool ``` psql -U postgres ``` ```sql CREATE DATABASE your_database_name; ① CREATE ROLE newuser WITH LOGIN PASSWORD 'password'; ② ③ /c your_database_name; GRANT ALL PRIVILEGES ON DATABASE your_database_name TO newuser; GRANT ALL PRIVILEGES ON SCHEMA public TO newuser; ``` #### Configure .env file 1. Open the .envexample file. 2. Change the name into '`.env` file. 3. Edit `.env` file. ``` ENGINE=django.db.backends.postgresql_psycopg2 # you don't need to change here NAME=your_database_name_here # ① USER=your_database_user_here # ② PASSWORD=your_database_password_here # ③ HOST=localhost_or_host_address_here # usually localhost ```
🌏Explore the world, mark your worldwide adventures with a click! 📌 This full-stack project 🗺️ is perfect for beginners, featuring interactive maps, user accounts, and secure data storage in the database! 🗄️
django,django-rest-framework,full-stack,full-stack-developer,full-stack-web-development,javascript,python3,react,react-webapp,beginner-friendly
2023-07-27T05:48:04Z
2023-09-04T18:30:10Z
null
1
0
78
0
1
2
null
null
JavaScript
ONJoseph/django_reddit_clone
master
#Django reddit Reddit clone written in python using django web framework and twitter's bootstrap. [![Build Status](https://travis-ci.org/Nikola-K/django_reddit.svg)](https://travis-ci.org/Nikola-K/django_reddit) [![Coverage Status](https://coveralls.io/repos/Nikola-K/django_reddit/badge.svg?branch=master&service=github)](https://coveralls.io/github/Nikola-K/django_reddit?branch=master) #Screenshots ![desktop_frontpage](_screenshots/desktop_frontpage 2015-06-22.jpg?raw=true) ![desktop_submission](_screenshots/desktop_submission 2015-06-22.jpg?raw=true) ![profile_view](_screenshots/profile_view 2015-06-24.png) ![profile_edit](_screenshots/profile_edit 2015-06-24.png) Fully responsive: ![mobile_frontpage](_screenshots/mobile_frontpage 2015-06-22.png?raw=true) ![mobile_submit](_screenshots/mobile_submit 2015-06-22.png?raw=true) ![mobile_thread](_screenshots/mobile_thread 2015-06-22.png?raw=true) #Getting up and running The project is python 3 only. The steps below will get you up and running with a local development environment. We assume you have the following installed: pip virtualenv First make sure to create and activate a virtualenv, then open a terminal at the project root and install the requirements for local development: $ pip install -r requirements.txt $ python manage.py migrate $ python manage.py syncdb $ python manage.py runserver For the time being there is no separate production specific settings because the project is not yet production ready. #Deployment * TODO: Write here how to deploy #License Copyright 2016 Nikola Kovacevic <nikolak@outlook.com> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. # cm1_python_test For candidates interested in working for cm1 Please fork this repo. Done. <h3> Main Test </h3> Please open CM1_DevQuickTest_Question.ipynb for the main tasks. Make a copy of the notebook rather than working on the main one. <u>Deliverables: </u> The link for your own colab workbook <h3>Django Test Instruction</h3> Hi there! You are going to make edits on a Django project. The Django project is a super simple version of Reddit. Note that the repo uses terminology that differs from Reddit terminology. Clone this repo (https://github.com/nikolak/django_reddit) and complete the following tasks: 1. Make it work. There are a couple bugs in the repo. Depending on your version, bugs are very likely to occur. We expect you to fix these bugs and make the original code run. <u> Deliverables:</u> Make a post with your full name and the date (Jul 04, 2023) or (MMM DD, YYYY) format and send over the screenshot. ![example image](https://drive.google.com/uc?id=147DRoB2dsmuXi_ABcEapiw-RpWvJoM0m) 2. For submissions that have URL, the code will automatically direct you to the URL rather than the submissions detail page. We are going to change it. When a user clicks on the submission/post from the home page, it will direct them to the detailed submission page (please find the right views.py function). If a submission has a URL, we will just display the URL as an additional line instead. <u> Deliverables:</u> You are going to make two posts, one with a URL and the other one without URL and send over the screenshot. ![example image](https://drive.google.com/uc?id=13TPEmHFWPcXML09gv4GSPOAYUHSx-RLv) 3. Let's add some additional information: submissions and comments on the user profile. <u> Deliverables:</u>: Make a couple of posts after registering yourself and take a screenshot of your profile with the list of comments and submissions. ![example image](https://drive.google.com/uc?id=1MqkgpmH0VG-_B-0Eq9Bb0Ylo4Pb0MUOZ) 4. Let's add an "Edit" button on the comment page that allows the right user to edit his own submissions. <u> Deliverables: </u>: Take two screenshots of the new comments page with the functioning "edit" bottom. First screenshot shows the submission and the second screenshot shows the SAME submission (with the same ID) but with edited content. Before: ![example image](https://drive.google.com/uc?id=16BUlkbCDKryD6g6dBZ4D5xNszgiKhfxD) After: ![example image](https://drive.google.com/uc?id=1VUzEJd9h8o6ppJO6JLR1f_1fEXo3gFb7) 5. Finally, please upload a youtube or loom video going over a live demo with the above tasks. ![profile_update](https://github.com/ONJoseph/django_reddit_clone/assets/60672480/5e01bb69-8c2f-4faa-8d50-566c11b54cb3) ![submissions_withou![without_edit_button](https://github.com/ONJoseph/django_reddit_clone/assets/60672480/aae08573-ddc3-442b-a6ba-758d2b559b16) t_url](https://github.com/ONJoseph/django_reddit_clone/assets/60672480/49e86f39-09c7-4eb7-9aed-38320e93cb57) ![Submissions _with_edit_button](https://github.com/ONJoseph/django_reddit_clone/assets/60672480/d3e64428-88eb-49b1-98cc-a8589c4e6322) ![submissions and comments on the user profile2](https://github.com/ONJoseph/django_reddit_clone/assets/60672480/1312195c-953f-4aaf-a826-1338ee6a723e) ![Submissions_with_url](https://github.com/ONJoseph/django_reddit_clone/assets/60672480/9c2cf9b6-54f6-478c-bd1d-2ee8782c81e4) ![profile_edit 2015-06-24](https://github.com/ONJoseph/django_reddit_clone/assets/60672480/e3586424-eff0-4746-bc4c-0fd7c2eaefb3) ![submissions and comments on the user profile1](https://github.com/ONJoseph/django_reddit_clone/assets/60672480/aa87c5ea-9501-404e-b7a9-02d871516a0b) Loom Video Link: https://www.loom.com/share/ade2f025929840808c2e0fd342b67f0c <h3>Once you finish, please reach out with your repo link. You can also email me at louisa@communityone.io</h3>
A simple reddit clone made with django
css,django,django-rest-framework,html,javascript,jquery,python,reddit,reddit-api
2023-07-27T14:38:49Z
2023-07-27T15:02:31Z
null
2
0
145
0
0
2
null
Apache-2.0
JavaScript
curumim15/BingoCirculoTrigonometrico
main
![Logo](https://cdn.discordapp.com/attachments/799980575867404308/1180866208883556473/Inicial.png?ex=657efa5b&is=656c855b&hm=fdd10a66026a2dae8f022e400a85c3d7e9de1b5fe9ad0a2c1bb949f57d9d2bff&) # **Bingo no Círculo Trigonométrico** **Status:** Done ✔️ Project done in school context, for the class of Project. The project aims to encourage students to learn the principles and applications of trigonometry in a fun and interactive way. The game was designed to help students consolidate their knowledge of the trigonometric circle, angles, coordinates and trigonometric functions. ## # **Specification** The project is an educational virtual game in the field of mathematics, created with the aim of helping students to practice trigonometry concepts in a fun and interactive way. The game has two game modes: **"Modo Bingo"** and **"Modo Prova"**. In **"Modo Bingo"**, the teacher starts the game and randomly draws numbers for the students to check if they have them on their cards. check if they have them on their cards. The students interact with a trigonometric circle, selecting the numbers drawn on their cards, in a similar way to traditional bingo. bingo. The teacher can follow the students' progress, checking how many exercises each one got it right or wrong. In **"Modo Prova"**, the teacher determines the number of numbers each student will have on their cards. cards. The students, in turn, click on the correct places in the trigonometric circle, according to the numbers provided by the teacher. The time taken by each student to solve the assessment is recorded, allowing the educator to assess the students' individual performance. ## # **Installation** This manual provides the information you need to install and run the project. To use this project, you must have the following programs installed on your computer: **Node.js installation** To install **Node.js**, follow these steps: > a. Visit the official [Node.js](https://nodejs.org/en/) website and click on the `"Download"` button. > b. Select the latest version and click on the `"Download"` button. > c. Follow the installer's instructions to complete the installation. **Installing an IDE** To run the project, follow these steps: > a. Open the **IDE** and open the project. > b. Go to the `"public"` folder and open the `"index.js"` file. > c. Open the terminal in the IDE and type `"node server.js"`. > d. Open the browser and go to [LocalHost](http://localhost:3000/). ## ## **Technologies** **Technologies:** `p5.js` `node.js + express` `socket.io` **IDE:** `Visual Studio Code` ## **Authors** - [@curumim15](https://github.com/curumim15) ## # **Student** **Modo Bingo** ![Logo](https://cdn.discordapp.com/attachments/799980575867404308/1180872739528114246/AlunoBingo.png?ex=657f0070&is=656c8b70&hm=28dfbced414ce56e11d24d879047a910543143562ab6ec312af382f80c4a5f20&) **Modo Prova** ![Logo](https://cdn.discordapp.com/attachments/799980575867404308/1180872746771685396/AlunoProva.png?ex=657f0072&is=656c8b72&hm=8da687716b4cdbae0d6eaa6176892e332b86ba209469880b671165dce4da10c7&) ## # **Teacher** **Modo Bingo** ![Logo](https://cdn.discordapp.com/attachments/799980575867404308/1180872785627729930/ProfessorBingo.png?ex=657f007b&is=656c8b7b&hm=b0740891c8e495f03214757cf04e11f7d68a18a35d105420a75aa2cff821995a&) **Modo Prova** ![Logo](https://cdn.discordapp.com/attachments/799980575867404308/1180872774890295357/ProfessorProva.png?ex=657f0079&is=656c8b79&hm=f0898a9da7343ec66f2a9d3ad330ce0a9c125e99e730f33101f0fe3430a2abe0&)
🎰 This work consisted of creating an educational virtual game called "Bingo in the Trigonometric Circle II". The game was built using different technologies, such as p5.js, node.js + express and socket.io.
express,javascript,nodejs,p5js,socketio
2023-08-06T10:49:09Z
2023-12-03T14:21:20Z
null
1
0
5
0
0
2
null
null
JavaScript
snehkr/INTERNPE-AUG23
main
<h1 align="center"> INTERNPE-WEB-DEVELOPMENT-AUG23 </h1> </br> ### Ⓜ️ Platform Used : - Visual Studio Code </br> ### 🐧 UI Based On : - Ben 10 Theme </br> ### 📝 TASK 1 : - A Simple Calculator With the help of HTML CSS & JS - <a href="https://internpe-internship.netlify.app/task-1/">LIVE DEMO </a> ### 📝 TASK 2 : - A E-Commerce Website With the help of HTML CSS & JS - <a href="https://internpe-internship.netlify.app/task-2/">LIVE DEMO </a> ### 📝 TASK 3 : - A TO-DO LIST APP With the help of HTML CSS & JS - <a href="https://internpe-internship.netlify.app/task-3/">LIVE DEMO </a> </br> ### [+] Find me on : <a href="https://telegram.me/SnehKr" target="_blank"><img src="https://img.shields.io/badge/Messenger-SnehKr-blue?style=for-the-badge&logo=messenger"></a> <a href="mailto:Snehkr.official@gmail.com" target="_blank"><img src="https://img.shields.io/badge/Email-Snehkr.official@gmail.com-blue?style=for-the-badge&logo=gmail"></a> </br> --- <h5 align="center">© 2023-24 SnehKr.</h5>
InternPe Internship WEB-DEV. AUG23
calculator,css,html,internship-task,intership,javascript,todolist,ecommerce,webdevelopment,website
2023-07-31T16:54:09Z
2023-11-18T10:31:27Z
null
2
1
11
0
0
2
null
GPL-3.0
CSS
legend1202/websocket-chat
master
*Websocket based group chat app built with socket.io, react and material-ui à la The Walking Dead flavor* Install. ``` bash npm install ``` Run the socket server. ``` bash npm run server ``` Run dev server, clients can be requested on localhost:3001. ``` bash npm run client ``` # Demo https://drive.google.com/file/d/1J3Y7j7YgIn_j44HOyJxZK1eCTSNSlTxV/view
Websocket based group chat app built with socket.io and react.
react,chat,javascript,material-ui,node,nodejs,socket,socket-io,socketio,styled-components
2023-07-25T07:50:55Z
2023-07-25T08:51:07Z
null
2
0
19
0
0
2
null
null
JavaScript
Farid-Karimi/Codeverse
master
# Sharing My Coding Studies ✍ Welcome to [CodeVerse](https://farid-karimi.github.io/Codeverse/), my personal knowledge base and digital garden! Here, I am excited to share my notes and thoughts on various coding topics with fellow enthusiasts like you. This static website, powered by markdown and transformed into HTML using an Obsidian plugin, serves as a platform for me to document and share my coding journey. ## Continuous Growth and Learning 🌱 [CodeVerse](https://farid-karimi.github.io/Codeverse/) is a dynamic platform that is constantly evolving. I am committed to regularly adding new content, ensuring that there's always something new to explore. Feel free to browse through the topics and immerse yourself in the world of coding. Let's learn together and build a vibrant community of passionate coders.
my personal knowledge base and digital garden!
css,digitalgarden,html,javascript,markdown,note-taking
2023-07-28T12:03:41Z
2024-02-23T14:58:41Z
null
1
1
23
0
0
2
null
null
HTML
pdt1806/erg-wordle
main
<p align="center"><img src="https://wordle.bennynguyen.dev/lib/icon.png" width="200px" /></p> <h1 align="center"><a href="https://wordle.bennynguyen.dev" target="_blank">ERG Wordle</a></h1> This is a recreation of the game Wordle. The game is a word puzzle game where the player has to guess a 5-letter word in 6 tries. The game will give feedback on the letters that are correct and in the right position, and the letters that are correct but in the wrong position. The game will also give feedback on the letters that are not in the word at all. Challenge your word-solving skills and see if you can crack the 5-letter word in just 6 tries. Test your vocabulary and logic to unravel the hidden word. ### Why play Wordle? - Wordle is a game that can be enjoyed by people of all ages. Whether you're a word enthusiast or just looking for a fun and challenging game, Wordle is perfect for you. - Playing Wordle can help improve your vocabulary and word-solving abilities. With each guess, you'll learn more about the word and sharpen your linguistic skills. - Wordle is available online, so you can play it anytime and anywhere. Whether you're on your computer, tablet, or smartphone, you can enjoy the game on the go. Don't wait any longer, start playing Wordle now and put your word-solving skills to the test! Can you guess the word in just 6 tries? ![](https://wordle.bennynguyen.dev/lib/wordle-showcase.png)
A remake of the popular game Wordle using pure HTML5, CSS and JavaScript.
css,css3,game,game-development,html,html5,javascript,puzzle,puzzle-game,wordle
2023-07-22T18:03:36Z
2024-03-25T22:15:32Z
null
1
0
30
0
0
2
null
null
HTML
fahimsahriar/digital-agency-frontend-design
main
# digital-agency-frontend-design This project showcases a mobile-responsive web page design implemented using HTML, CSS, and JavaScript. The design is sleek and modern, utilizing various raw CSS techniques such as CSS variables and flexbox to ensure flexibility and visual appeal. ## Features - Mobile-responsive layout - Utilizes CSS variables for easy customization - Uses flexbox for flexible and adaptive design - Built with raw CSS, no frameworks or libraries - Deployed on GitHub for easy access and collaboration ## Deployment The web page design is deployed and hosted on GitHub. You can access it by visiting [GitHub Pages](https://fahimsahriar.github.io/front-end-hero-section-design/). ## Usage To use or contribute to this project, follow these steps: 1. Clone the repository: `git clone https://github.com/fahimsahriar/front-end-hero-section-design.git` 2. Open the index.html file in your preferred web browser. 3. Explore the design and customize it as needed. 4. Feel free to submit pull requests with any improvements or bug fixes. ## License This project is licensed under the [MIT License](LICENSE).
This project showcases a mobile-responsive web page design implemented using HTML, CSS, and JavaScript.
bootstrap,css,digital-marketing-company,html,javascript
2023-07-21T16:26:57Z
2023-07-21T16:31:50Z
null
1
0
3
0
0
2
null
null
HTML
Pazdikan/wikifs
master
![Banner](./.github/Banner.png) ![GitHub](https://img.shields.io/github/license/pazdikan/wikifs?style=for-the-badge) ![GitHub commit activity (branch)](https://img.shields.io/github/commit-activity/m/pazdikan/wikifs?style=for-the-badge) ![GitHub last commit (by committer)](https://img.shields.io/github/last-commit/pazdikan/wikifs?style=for-the-badge) ![GitHub Release Date - Published_At](https://img.shields.io/github/v/release/pazdikan/wikifs?style=for-the-badge) # Documentation [Hosted here](https://docs.pazdikan.party/en/wikifs/About) # Support Join my [Discord](https://dc.pazdikan.party/) for direct contact or use [issues](https://github.com/Pazdikan/wikifs/issues). The second option is best so others with the same issue can find a solution quicker. # Installation Basically clone this, run `npm i`, copy `src/settings.js.example` to `src/settings.js`, configure everything and start it using `node .`. I don't know if this is secured properly (probably it's not) 💀
A private wiki software focusing on storing publicly available information (OSINT) in local JSON files.
osint,osint-tool,wiki,express,javascript,nodejs,social-media,web
2023-07-21T13:10:04Z
2023-11-27T20:39:37Z
2023-08-31T21:46:07Z
1
3
77
1
0
2
null
MIT
JavaScript
Kei-K23/javascript-things
main
# JavaScript-things [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) ## Description This project is for everyone who wants to work with pure JavaScript, build something nice with JavaScript, and learn more about javascript by building something. ## Table of Contents - [Installation](#installation) - [Contributing](#contributing) - [License](#license) ## Installation You can run the code provided in this project by using live server or just copy the HTML path into your borwser. ## Contributing All contributions are really appreciated and welcome. Please come up with some ideas and contribute in this project. You can contrubute by make forking this repo, make some changes or add new JavaScript things to the project after that make pull request. Contrubution requirement- - must be written in vanilla javascript - should be include at least one *.html, *.css and *.js files - try to use standard and produce clean code ## License This project is licensed under the [MIT License](LICENSE).
javascript-things is open-source project for everyone who want to create some nice thing written in vanilla JavaScript.
javascript,vanilla-javascript
2023-08-06T10:59:55Z
2023-08-18T05:15:09Z
null
1
3
18
0
1
2
null
MIT
JavaScript
Nelofarzabi/Leaderboard
dev
<a name="readme-top"></a> # 📗 Table of Contents - [📖 About the Project](#about-project) - [🛠 Built With](#built-with) - [Tech Stack](#tech-stack) - [Key Features](#key-features) - [🚀 Live Demo](#live-demo) - [💻 Getting Started](#getting-started) - [Setup](#setup) - [Prerequisites](#prerequisites) - [Install](#install) - [Usage](#usage) - [Run tests](#run-tests) - [Deployment](#Deployment) - [👥 Authors](#authors) - [🤝 Contributing](#contributing) - [⭐️ Show your support](#support) - [🙏 Acknowledgements](#acknowledgements) - [❓ FAQ (OPTIONAL)](#faq) - [📝 License](#license) <!-- PROJECT DESCRIPTION --> # 📖 [Leaderboard] <a name="about-project"></a> "In this Leaderboad project add name and score using API.Furthermore, use webpack to render all script,css,html,images,icons and font into single file. By building this application, you will learn how to manage data using JavaScript. we also use a medium-fidelity wireframe to build the UI. ## 🛠 Built With <a name="built-with"></a> ### Tech Stack <a name="tech-stack"></a> HTML, CSS & JAVASCRIPT GitHub & Visual Studio Code <!-- Features --> ### Key Features <a name="key-features"></a> - Use wire frame model to build a leaderboard setup - Use import, export, modules to simplify the code - Use arrow functions and classes as well for reusability - use webpack for smooth working <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- LIVE DEMO --> ## 🚀 Live Demo <a name="live-demo"></a> [Live Demo](https://nelofarzabi.github.io/Leaderboard/dist/) <p align="right">(<a href="https://github.com/faisalakb/leaderboardAPI">back to top</a>)</p> <!-- GETTING STARTED --> ## 💻 Getting Started <a name="getting-started"></a> ### Prerequisites In order to run this project you need: <a href="https://nodejs.org/en">- Node.js</a> <a href="https://git-scm.com/downloads">- Git</a> ### Setup Install Node Js on your local computer. ### Install To Install this project : you need to clone the following link. <pre> git clone https://github.com/Nelofarzabi/Leaderboard.git</pre> ### Usage To run the project, write on terminal : npm start Note: you need to first setup your webpack setup ### Run tests To run tests, run a live server on your computer.. ### Deployment <a name="Deployment"></a> You can deploy this project in this link by <a href="https://github.com/Nelofarzabi/Leaderboard">click</a> <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- AUTHORS --> ## 👥 Authors <a name="authors"></a> 👤 **Nelofar Zabi** - GitHub: [@githubhandle](https://github.com/Nelofarzabi) - Twitter: [@twitterhandle](https://twitter.com/NelofarZabi) - LinkedIn: [LinkedIn](https://www.linkedin.com/in/nelofar-zabi-1a1066213) <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- FUTURE FEATURES --> ## 🔭 Future Features <a name="future-features"></a> - [ ] **Web API** <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- CONTRIBUTING --> ## 🤝 Contributing <a name="contributing"></a> Contributions, issues, and feature requests are welcome! Feel free to check the [issues page](../../issues/). <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- SUPPORT --> ## ⭐️ Show your support <a name="support"></a> > Hello, feel free to support this project <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- LICENSE --> ## 📝 License <a name="license"></a> This project is [MIT](./LICENSE) licensed. <p align="right">(<a href="#readme-top">back to top</a>)</p>
This is a JavaScript-based leaderboard web app that displays scores and rankings for a game or activity. It is designed to be simple and easy to use, featuring a clean and intuitive user interface.
api,css3,javascript,linters,gitflow,webpack
2023-07-28T02:09:34Z
2023-09-06T06:51:33Z
null
1
3
21
0
0
2
null
MIT
JavaScript
Basa2000/07.Password-Generator
main
![MasterHead](https://camo.githubusercontent.com/1f034ebfc52e5fdcc097e7b3c6c9100e1fd606f5a99af8ea35f1d3a936bbfdfa/687474703a2f2f7777772e7072616d756b686469676974616c2e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031382f30372f4e65772d504e432d416e696d617465642d42616e6e6572732e676966) <h1 align="center">Hi 👋, I'm Basavaraj Kumbhar</h1> <h3 align="center">A passionate MERN Full Stack Developer from India</h3> <img src="https://cdn.dribbble.com/users/1162077/screenshots/3848914/programmer.gif" alt="coding" align="right" width="400"> <p align="left"> <img src="https://komarev.com/ghpvc/?username=basa2000&label=Profile%20views&color=0e75b6&style=flat" alt="basa2000" /> </p> - 🔭 I’m currently worked on [Password Generator](https://bk-password-generator.netlify.app/) - 🌱 I’m currently learning **React.js, Backend Technologies** - 💬 Ask me about **MERN** - 📫 How to reach me **basavkumbhar1432@gmail.com** <h3 align="left">Connect with me:</h3> <p align="left"> <a href="https://www.linkedin.com/in/basavaraj-kumbhar-a68672220/" target="blank"><img align="center" src="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/linked-in-alt.svg" alt="basavaraj kumbhar" height="30" width="40" /></a> <a href="https://instagram.com/kumbhar_basavaraj_" target="blank"><img align="center" src="https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/instagram.svg" alt="kumbhar_basavaraj_" height="30" width="40" /></a> </p> <h3 align="left">Languages and Tools:</h3> <p align="left"> <a href="https://www.w3schools.com/css/" target="_blank" rel="noreferrer"> <img src="https://raw.githubusercontent.com/devicons/devicon/master/icons/css3/css3-original-wordmark.svg" alt="css3" width="40" height="40"/> </a> <a href="https://www.w3.org/html/" target="_blank" rel="noreferrer"> <img src="https://raw.githubusercontent.com/devicons/devicon/master/icons/html5/html5-original-wordmark.svg" alt="html5" width="40" height="40"/> </a> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript" target="_blank" rel="noreferrer"> <img src="https://raw.githubusercontent.com/devicons/devicon/master/icons/javascript/javascript-original.svg" alt="javascript" width="40" height="40"/> </a> <a href="https://reactjs.org/" target="_blank" rel="noreferrer"> <img src="https://raw.githubusercontent.com/devicons/devicon/master/icons/react/react-original-wordmark.svg" alt="react" width="40" height="40"/> </a> <a href="https://tailwindcss.com/" target="_blank" rel="noreferrer"> <img src="https://www.vectorlogo.zone/logos/tailwindcss/tailwindcss-icon.svg" alt="tailwind" width="40" height="40"/> </a> </p>
Password Generator is an application to generate a strong password. While generating a password, the user can choose various combinations, like length, uppercase letters, lowercase letters, numbers, and symbols. Users will get notified about the strength( Strong, Medium & Weak ) of the password.
css,html,javascript,responsive-design,strong-password-generator
2023-07-30T10:06:35Z
2023-07-30T10:37:17Z
null
1
0
5
0
0
2
null
null
JavaScript
cheng-alvin/durian.js
main
# Durian.js ![](https://img.shields.io/github/v/tag/cheng-alvin/durian.js) ![](https://img.shields.io/github/languages/code-size/cheng-alvin/durian.js) ![](https://img.shields.io/github/license/cheng-alvin/durian.js) ![](https://img.shields.io/github/issues/cheng-alvin/durian.js) ![](https://img.shields.io/github/issues-pr/cheng-alvin/durian.js) <img src="https://github.com/cheng-alvin/durian.js/blob/e2cb327e0e5d7067afc4230326dfcfc163296767/%E5%B1%8F%E5%B9%95%E6%88%AA%E5%9B%BE%202023-09-01%20150235.png" alt="logo" align="right" width="180" /> Welcome to the official durian.js source tree! This is where the contents of the Durian project are held. If you did not know, Durian.js is a lightweight Javascript framework that allows for an easier time dealing with HTML by allowing for dynamic components with custom HTML tags. Let's throw out all the trash and garbage that causes slow apps and huge bundle sizes and start with plain old Javascript—no more Virtual DOMs or compilers, just HTML! How simple! ### 📜 [LICENSE](https://github.com/cheng-alvin/durian.js/blob/main/LICENSE) The Durian project is licensed with the [MIT](https://en.wikipedia.org/wiki/MIT_License) license, this means that the Durian project is free and open source and can be used in commercial and personal situations without prior consent of the creator. However, please note that more information is in the [LICENSE](https://github.com/cheng-alvin/durian.js/blob/main/LICENSE) file for people who want to understand more. ### ⬆️ Motivation Most Javascript frameworks claim to be fast, reliable, safe and simple to learn. However, the hard truth is that many of them are very painful to work with. Often there are way too many abstractions and baggage that make learning and development slow. Virtual dom, compilers and hydration take up way too much space and create a hasel to deal with! That's where Durian.js comes into play, Durian drops away the heavy baggage that large enterprise frameworks use and relies on pure HTML elements that take up minimal space, are reliable and have minimal working parts to worry about and just are easier to work with! Forget the hassle and move to Durian now! Remember, even plain HTML code can be easily migrated! ### 🔁 CHANGELOG The changelog of the durian.js software is released in a tag format, although the releases are avalible in the [releases](https://github.com/cheng-alvin/durian.js/releases) tab, you can also find it inside the [`CHANGELOG.md`](https://github.com/cheng-alvin/durian.js/blob/main/CHANGELOG.md) file for a more detailed explaination and full history. --- Copyright (c) 2023 [Alvin Cheng](https://github.com/cheng-alvin)
Durian.js is a lightweight Javascript framework that allows for custom HTML tag to create interactive components for large applications! Easy to learn, light and fun to develop with!
framework,js,node,npm,ts,javascript,typescript,npm-package,css,html
2023-08-04T06:55:13Z
2023-09-11T04:14:54Z
null
1
14
88
5
2
2
null
MIT
JavaScript
avinashbt/reactjs-most-asked-interview-questions-2023
main
# React Interview Questions & Answers --- <div> <p align="center"> ABT </p> </div> --- ### Table of Contents | No. | Questions | | --- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | | **Core React** | | 1 | [What is React?](#what-is-react) | | 2 | [What are the major features of React?](#what-are-the-major-features-of-react) | | 3 | [What is JSX?](#what-is-jsx) | | 4 | [What is the difference between Element and Component?](#what-is-the-difference-between-element-and-component) | | 5 | [How to create components in React?](#how-to-create-components-in-react) | | 6 | [When to use a Class Component over a Function Component?](#when-to-use-a-class-component-over-a-function-component) | | 7 | [What are Pure Components?](#what-are-pure-components) | | 8 | [What is state in React?](#what-is-state-in-react) | | 9 | [What are props in React?](#what-are-props-in-react) | | 10 | [What is the difference between state and props?](#what-is-the-difference-between-state-and-props) | | 11 | [Why should we not update the state directly?](#why-should-we-not-update-the-state-directly) | | 12 | [What is the purpose of callback function as an argument of setState()?](#what-is-the-purpose-of-callback-function-as-an-argument-of-setstate) | | 13 | [What is the difference between HTML and React event handling?](#what-is-the-difference-between-html-and-react-event-handling) | | 14 | [How to bind methods or event handlers in JSX callbacks?](#how-to-bind-methods-or-event-handlers-in-jsx-callbacks) | | 15 | [How to pass a parameter to an event handler or callback?](#how-to-pass-a-parameter-to-an-event-handler-or-callback) | | 16 | [What are synthetic events in React?](#what-are-synthetic-events-in-react) | | 17 | [What are inline conditional expressions?](#what-are-inline-conditional-expressions) | | 18 | [What is "key" prop and what is the benefit of using it in arrays of elements?](#what-is-key-prop-and-what-is-the-benefit-of-using-it-in-arrays-of-elements) | | 19 | [What is the use of refs?](#what-is-the-use-of-refs) | | 20 | [How to create refs?](#how-to-create-refs) | | 21 | [What are forward refs?](#what-are-forward-refs) | | 22 | [Which is preferred option with in callback refs and findDOMNode()?](#which-is-preferred-option-with-in-callback-refs-and-finddomnode) | | 23 | [Why are String Refs legacy?](#why-are-string-refs-legacy) | | 24 | [What is Virtual DOM?](#what-is-virtual-dom) | | 25 | [How Virtual DOM works?](#how-virtual-dom-works) | | 26 | [What is the difference between Shadow DOM and Virtual DOM?](#what-is-the-difference-between-shadow-dom-and-virtual-dom) | | 27 | [What is React Fiber?](#what-is-react-fiber) | | 28 | [What is the main goal of React Fiber?](#what-is-the-main-goal-of-react-fiber) | | 29 | [What are controlled components?](#what-are-controlled-components) | | 30 | [What are uncontrolled components?](#what-are-uncontrolled-components) | | 31 | [What is the difference between createElement and cloneElement?](#what-is-the-difference-between-createelement-and-cloneelement) | | 32 | [What is Lifting State Up in React?](#what-is-lifting-state-up-in-react) | | 33 | [What are the different phases of component lifecycle?](#what-are-the-different-phases-of-component-lifecycle) | | 34 | [What are the lifecycle methods of React?](#what-are-the-lifecycle-methods-of-react) | | 35 | [What are Higher-Order components?](#what-are-higher-order-components) | | 36 | [How to create props proxy for HOC component?](#how-to-create-props-proxy-for-hoc-component) | | 37 | [What is context?](#what-is-context) | | 38 | [What is children prop?](#what-is-children-prop) | | 39 | [How to write comments in React?](#how-to-write-comments-in-react) | | 40 | [What is the purpose of using super constructor with props argument?](#what-is-the-purpose-of-using-super-constructor-with-props-argument) | | 41 | [What is reconciliation?](#what-is-reconciliation) | | 42 | [How to set state with a dynamic key name?](#how-to-set-state-with-a-dynamic-key-name) | | 43 | [What would be the common mistake of function being called every time the component renders?](#what-would-be-the-common-mistake-of-function-being-called-every-time-the-component-renders) | | 44 | [Is lazy function supports named exports?](#is-lazy-function-supports-named-exports) | | 45 | [Why React uses className over class attribute?](#why-react-uses-classname-over-class-attribute) | | 46 | [What are fragments?](#what-are-fragments) | | 47 | [Why fragments are better than container divs?](#why-fragments-are-better-than-container-divs) | | 48 | [What are portals in React?](#what-are-portals-in-react) | | 49 | [What are stateless components?](#what-are-stateless-components) | | 50 | [What are stateful components?](#what-are-stateful-components) | | 51 | [How to apply validation on props in React?](#how-to-apply-validation-on-props-in-react) | | 52 | [What are the advantages of React?](#what-are-the-advantages-of-react) | | 53 | [What are the limitations of React?](#what-are-the-limitations-of-react) | | 54 | [What are error boundaries in React v16](#what-are-error-boundaries-in-react-v16) | | 55 | [How are error boundaries handled in React v15?](#how-are-error-boundaries-handled-in-react-v15) | | 56 | [What are the recommended ways for static type checking?](#what-are-the-recommended-ways-for-static-type-checking) | | 57 | [What is the use of react-dom package?](#what-is-the-use-of-react-dom-package) | | 58 | [What is the purpose of render method of react-dom?](#what-is-the-purpose-of-render-method-of-react-dom) | | 59 | [What is ReactDOMServer?](#what-is-reactdomserver) | | 60 | [How to use InnerHtml in React?](#how-to-use-innerhtml-in-react) | | 61 | [How to use styles in React?](#how-to-use-styles-in-react) | | 62 | [How events are different in React?](#how-events-are-different-in-react) | | 63 | [What will happen if you use setState in constructor?](#what-will-happen-if-you-use-setstate-in-constructor) | | 64 | [What is the impact of indexes as keys?](#what-is-the-impact-of-indexes-as-keys) | | 65 | [Is it good to use setState() in componentWillMount() method?](#is-it-good-to-use-setstate-in-componentwillmount-method) | | 66 | [What will happen if you use props in initial state?](#what-will-happen-if-you-use-props-in-initial-state) | | 67 | [How do you conditionally render components?](#how-do-you-conditionally-render-components) | | 68 | [Why we need to be careful when spreading props on DOM elements??](#why-we-need-to-be-careful-when-spreading-props-on-dom-elements) | | 69 | [How you use decorators in React?](#how-you-use-decorators-in-react) | | 70 | [How do you memoize a component?](#how-do-you-memoize-a-component) | | 71 | [How you implement Server-Side Rendering or SSR?](#how-you-implement-server-side-rendering-or-ssr) | | 72 | [How to enable production mode in React?](#how-to-enable-production-mode-in-react) | | 73 | [What is CRA and its benefits?](#what-is-cra-and-its-benefits) | | 74 | [What is the lifecycle methods order in mounting?](#what-is-the-lifecycle-methods-order-in-mounting) | | 75 | [What are the lifecycle methods going to be deprecated in React v16?](#what-are-the-lifecycle-methods-going-to-be-deprecated-in-react-v16) | | 76 | [What is the purpose of getDerivedStateFromProps() lifecycle method?](#what-is-the-purpose-of-getderivedstatefromprops-lifecycle-method) | | 77 | [What is the purpose of getSnapshotBeforeUpdate() lifecycle method?](#what-is-the-purpose-of-getsnapshotbeforeupdate-lifecycle-method) | | 78 | [Do Hooks replace render props and higher order components?](#do-hooks-replace-render-props-and-higher-order-components) | | 79 | [What is the recommended way for naming components?](#what-is-the-recommended-way-for-naming-components) | | 80 | [What is the recommended ordering of methods in component class?](#what-is-the-recommended-ordering-of-methods-in-component-class) | | 81 | [What is a switching component?](#what-is-a-switching-component) | | 82 | [Why we need to pass a function to setState()?](#why-we-need-to-pass-a-function-to-setstate) | | 83 | [What is strict mode in React?](#what-is-strict-mode-in-react) | | 84 | [What are React Mixins?](#what-are-react-mixins) | | 85 | [Why is isMounted() an anti-pattern and what is the proper solution?](#why-is-ismounted-an-anti-pattern-and-what-is-the-proper-solution) | | 86 | [What are the Pointer Events supported in React?](#what-are-the-pointer-events-supported-in-react) | | 87 | [Why should component names start with capital letter?](#why-should-component-names-start-with-capital-letter) | | 88 | [Are custom DOM attributes supported in React v16?](#are-custom-dom-attributes-supported-in-react-v16) | | 89 | [What is the difference between constructor and getInitialState?](#what-is-the-difference-between-constructor-and-getinitialstate) | | 90 | [Can you force a component to re-render without calling setState?](#can-you-force-a-component-to-re-render-without-calling-setstate) | | 91 | [What is the difference between super() and super(props) in React using ES6 classes?](#what-is-the-difference-between-super-and-superprops-in-react-using-es6-classes) | | 92 | [How to loop inside JSX?](#how-to-loop-inside-jsx) | | 93 | [How do you access props in attribute quotes?](#how-do-you-access-props-in-attribute-quotes) | | 94 | [What is React PropType array with shape?](#what-is-react-proptype-array-with-shape) | | 95 | [How to conditionally apply class attributes?](#how-to-conditionally-apply-class-attributes) | | 96 | [What is the difference between React and ReactDOM?](#what-is-the-difference-between-react-and-reactdom) | | 97 | [Why ReactDOM is separated from React?](#why-reactdom-is-separated-from-react) | | 98 | [How to use React label element?](#how-to-use-react-label-element) | | 99 | [How to combine multiple inline style objects?](#how-to-combine-multiple-inline-style-objects) | | 100 | [How to re-render the view when the browser is resized?](#how-to-re-render-the-view-when-the-browser-is-resized) | | 101 | [What is the difference between setState and replaceState methods?](#what-is-the-difference-between-setstate-and-replacestate-methods) | | 102 | [How to listen to state changes?](#how-to-listen-to-state-changes) | | 103 | [What is the recommended approach of removing an array element in react state?](#what-is-the-recommended-approach-of-removing-an-array-element-in-react-state) | | 104 | [Is it possible to use React without rendering HTML?](#is-it-possible-to-use-react-without-rendering-html) | | 105 | [How to pretty print JSON with React?](#how-to-pretty-print-json-with-react) | | 106 | [Why you can't update props in React?](#why-you-cant-update-props-in-react) | | 107 | [How to focus an input element on page load?](#how-to-focus-an-input-element-on-page-load) | | 108 | [What are the possible ways of updating objects in state?](#what-are-the-possible-ways-of-updating-objects-in-state) | | 110 | [How can we find the version of React at runtime in the browser?](#how-can-we-find-the-version-of-react-at-runtime-in-the-browser) | | 111 | [What are the approaches to include polyfills in your create-react-app?](#what-are-the-approaches-to-include-polyfills-in-your-create-react-app) | | 112 | [How to use https instead of http in create-react-app?](#how-to-use-https-instead-of-http-in-create-react-app) | | 113 | [How to avoid using relative path imports in create-react-app?](#how-to-avoid-using-relative-path-imports-in-create-react-app) | | 114 | [How to add Google Analytics for react-router?](#how-to-add-google-analytics-for-react-router) | | 115 | [How to update a component every second?](#how-to-update-a-component-every-second) | | 116 | [How do you apply vendor prefixes to inline styles in React?](#how-do-you-apply-vendor-prefixes-to-inline-styles-in-react) | | 117 | [How to import and export components using react and ES6?](#how-to-import-and-export-components-using-react-and-es6) | | 118 | [What are the exceptions on React component naming?](#what-are-the-exceptions-on-react-component-naming) | | 119 | [Why is a component constructor called only once?](#why-is-a-component-constructor-called-only-once) | | 120 | [How to define constants in React?](#how-to-define-constants-in-react) | | 121 | [How to programmatically trigger click event in React?](#how-to-programmatically-trigger-click-event-in-react) | | 122 | [Is it possible to use async/await in plain React?](#is-it-possible-to-use-asyncawait-in-plain-react) | | 123 | [What are the common folder structures for React?](#what-are-the-common-folder-structures-for-react) | | 124 | [What are the popular packages for animation?](#what-are-the-popular-packages-for-animation) | | 125 | [What is the benefit of styles modules?](#what-is-the-benefit-of-styles-modules) | | 126 | [What are the popular React-specific linters?](#what-are-the-popular-react-specific-linters) | | 127 | [How to make AJAX call and In which component lifecycle methods should I make an AJAX call?](#how-to-make-ajax-call-and-in-which-component-lifecycle-methods-should-i-make-an-ajax-call) | | 128 | [What are render props?](#what-are-render-props) | | | **React Router** | | 129 | [What is React Router?](#what-is-react-router) | | 130 | [How React Router is different from history library?](#how-react-router-is-different-from-history-library) | | 131 | [What are the \<Router> components of React Router v4?](#what-are-the-router-components-of-react-router-v4) | | 132 | [What is the purpose of push and replace methods of history?](#what-is-the-purpose-of-push-and-replace-methods-of-history) | | 133 | [How do you programmatically navigate using React router v4?](#how-do-you-programmatically-navigate-using-react-router-v4) | | 134 | [How to get query parameters in React Router v4](#how-to-get-query-parameters-in-react-router-v4) | | 135 | [Why you get "Router may have only one child element" warning?](#why-you-get-router-may-have-only-one-child-element-warning) | | 136 | [How to pass params to history.push method in React Router v4?](#how-to-pass-params-to-historypush-method-in-react-router-v4) | | 137 | [How to implement default or NotFound page?](#how-to-implement-default-or-notfound-page) | | 138 | [How to get history on React Router v4?](#how-to-get-history-on-react-router-v4) | | 139 | [How to perform automatic redirect after login?](#how-to-perform-automatic-redirect-after-login) | | | **React Internationalization** | | 140 | [What is React-Intl?](#what-is-react-intl) | | 141 | [What are the main features of React Intl?](#what-are-the-main-features-of-react-intl) | | 142 | [What are the two ways of formatting in React Intl?](#what-are-the-two-ways-of-formatting-in-react-intl) | | 143 | [How to use FormattedMessage as placeholder using React Intl?](#how-to-use-formattedmessage-as-placeholder-using-react-intl) | | 144 | [How to access current locale with React Intl](#how-to-access-current-locale-with-react-intl) | | 145 | [How to format date using React Intl?](#how-to-format-date-using-react-intl) | | | **React Testing** | | 146 | [What is Shallow Renderer in React testing?](#what-is-shallow-renderer-in-react-testing) | | 147 | [What is TestRenderer package in React?](#what-is-testrenderer-package-in-react) | | 148 | [What is the purpose of ReactTestUtils package?](#what-is-the-purpose-of-reacttestutils-package) | | 149 | [What is Jest?](#what-is-jest) | | 150 | [What are the advantages of Jest over Jasmine?](#what-are-the-advantages-of-jest-over-jasmine) | | 151 | [Give a simple example of Jest test case](#give-a-simple-example-of-jest-test-case) | | | **React Redux** | | 152 | [What is Flux?](#what-is-flux) | | 153 | [What is Redux?](#what-is-redux) | | 154 | [What are the core principles of Redux?](#what-are-the-core-principles-of-redux) | | 155 | [What are the downsides of Redux compared to Flux?](#what-are-the-downsides-of-redux-compared-to-flux) | | 156 | [What is the difference between mapStateToProps() and mapDispatchToProps()?](#what-is-the-difference-between-mapstatetoprops-and-mapdispatchtoprops) | | 157 | [Can I dispatch an action in reducer?](#can-i-dispatch-an-action-in-reducer) | | 158 | [How to access Redux store outside a component?](#how-to-access-redux-store-outside-a-component) | | 159 | [What are the drawbacks of MVW pattern](#what-are-the-drawbacks-of-mvw-pattern) | | 160 | [Are there any similarities between Redux and RxJS?](#are-there-any-similarities-between-redux-and-rxjs) | | 161 | [How to dispatch an action on load?](#how-to-dispatch-an-action-on-load) | | 162 | [How to use connect from React Redux?](#how-to-use-connect-from-react-redux) | | 163 | [How to reset state in Redux?](#how-to-reset-state-in-redux) | | 164 | [Whats the purpose of at symbol in the redux connect decorator?](#whats-the-purpose-of-at-symbol-in-the-redux-connect-decorator) | | 165 | [What is the difference between React context and React Redux?](#what-is-the-difference-between-react-context-and-react-redux) | | 166 | [Why are Redux state functions called reducers?](#why-are-redux-state-functions-called-reducers) | | 167 | [How to make AJAX request in Redux?](#how-to-make-ajax-request-in-redux) | | 168 | [Should I keep all component's state in Redux store?](#should-i-keep-all-components-state-in-redux-store) | | 169 | [What is the proper way to access Redux store?](#what-is-the-proper-way-to-access-redux-store) | | 170 | [What is the difference between component and container in React Redux?](#what-is-the-difference-between-component-and-container-in-react-redux) | | 171 | [What is the purpose of the constants in Redux? ](#what-is-the-purpose-of-the-constants-in-redux) | | 172 | [What are the different ways to write mapDispatchToProps()?](#what-are-the-different-ways-to-write-mapdispatchtoprops) | | 173 | [What is the use of the ownProps parameter in mapStateToProps() and mapDispatchToProps()?](#what-is-the-use-of-the-ownprops-parameter-in-mapstatetoprops-and-mapdispatchtoprops) | | 174 | [How to structure Redux top level directories?](#how-to-structure-redux-top-level-directories) | | 175 | [What is redux-saga?](#what-is-redux-saga) | | 176 | [What is the mental model of redux-saga?](#what-is-the-mental-model-of-redux-saga) | | 177 | [What are the differences between call and put in redux-saga](#what-are-the-differences-between-call-and-put-in-redux-saga) | | 178 | [What is Redux Thunk?](#what-is-redux-thunk) | | 179 | [What are the differences between redux-saga and redux-thunk](#what-are-the-differences-between-redux-saga-and-redux-thunk) | | 180 | [What is Redux DevTools?](#what-is-redux-devtools) | | 181 | [What are the features of Redux DevTools?](#what-are-the-features-of-redux-devtools) | | 182 | [What are Redux selectors and Why to use them?](#what-are-redux-selectors-and-why-to-use-them) | | 183 | [What is Redux Form?](#what-is-redux-form) | | 184 | [What are the main features of Redux Form?](#what-are-the-main-features-of-redux-form) | | 185 | [How to add multiple middlewares to Redux?](#how-to-add-multiple-middlewares-to-redux) | | 186 | [How to set initial state in Redux?](#how-to-set-initial-state-in-redux) | | 187 | [How Relay is different from Redux?](#how-relay-is-different-from-redux) | | 188 | [What is an action in Redux?](#what-is-an-action-in-redux) | | | **React Native** | | 188 | [What is the difference between React Native and React?](#what-is-the-difference-between-react-native-and-react) | | 189 | [How to test React Native apps?](#how-to-test-react-native-apps) | | 190 | [How to do logging in React Native?](#how-to-do-logging-in-react-native) | | 191 | [How to debug your React Native?](#how-to-debug-your-react-native) | | | **React supported libraries and Integration** | | 192 | [What is reselect and how it works?](#what-is-reselect-and-how-it-works) | | 193 | [What is Flow?](#what-is-flow) | | 194 | [What is the difference between Flow and PropTypes?](#what-is-the-difference-between-flow-and-proptypes) | | 195 | [How to use font-awesome icons in React?](#how-to-use-font-awesome-icons-in-react) | | 196 | [What is React Dev Tools?](#what-is-react-dev-tools) | | 197 | [Why is DevTools not loading in Chrome for local files?](#why-is-devtools-not-loading-in-chrome-for-local-files) | | 198 | [How to use Polymer in React?](#how-to-use-polymer-in-react) | | 199 | [What are the advantages of React over Vue.js?](#what-are-the-advantages-of-react-over-vuejs) | | 200 | [What is the difference between React and Angular?](#what-is-the-difference-between-react-and-angular) | | 201 | [Why React tab is not showing up in DevTools?](#why-react-tab-is-not-showing-up-in-devtools) | | 202 | [What are styled components?](#what-are-styled-components) | | 203 | [Give an example of Styled Components?](#give-an-example-of-styled-components) | | 204 | [What is Relay?](#what-is-relay) | | 205 | [How to use TypeScript in create-react-app application?](#how-to-use-typescript-in-create-react-app-application) | | | **Miscellaneous** | | 206 | [What are the main features of reselect library?](#what-are-the-main-features-of-reselect-library) | | 207 | [Give an example of reselect usage?](#give-an-example-of-reselect-usage) | | 209 | [Does the statics object work with ES6 classes in React?](#does-the-statics-object-work-with-es6-classes-in-react) | | 210 | [Can Redux only be used with React?](#can-redux-only-be-used-with-react) | | 211 | [Do you need to have a particular build tool to use Redux?](#do-you-need-to-have-a-particular-build-tool-to-use-redux) | | 212 | [How Redux Form initialValues get updated from state?](#how-redux-form-initialvalues-get-updated-from-state) | | 213 | [How React PropTypes allow different type for one prop?](#how-react-proptypes-allow-different-types-for-one-prop) | | 214 | [Can I import an SVG file as react component?](#can-i-import-an-svg-file-as-react-component) | | 215 | [Why are inline ref callbacks or functions not recommended?](#why-are-inline-ref-callbacks-or-functions-not-recommended) | | 216 | [What is render hijacking in React?](#what-is-render-hijacking-in-react) | | 217 | [What are HOC factory implementations?](#what-are-hoc-factory-implementations) | | 218 | [How to pass numbers to React component?](#how-to-pass-numbers-to-react-component) | | 219 | [Do I need to keep all my state into Redux? Should I ever use react internal state?](#do-i-need-to-keep-all-my-state-into-redux-should-i-ever-use-react-internal-state) | | 220 | [What is the purpose of registerServiceWorker in React?](#what-is-the-purpose-of-registerserviceworker-in-react) | | 221 | [What is React memo function?](#what-is-react-memo-function) | | 222 | [What is React lazy function?](#what-is-react-lazy-function) | | 223 | [How to prevent unnecessary updates using setState?](#how-to-prevent-unnecessary-updates-using-setstate) | | 224 | [How do you render Array, Strings and Numbers in React 16 Version?](#how-do-you-render-array-strings-and-numbers-in-react-16-version) | | 225 | [How to use class field declarations syntax in React classes?](#how-to-use-class-field-declarations-syntax-in-react-classes) | | 226 | [What are hooks?](#what-are-hooks) | | 227 | [What rules need to be followed for hooks?](#what-rules-need-to-be-followed-for-hooks) | | 228 | [How to ensure hooks followed the rules in your project?](#how-to-ensure-hooks-followed-the-rules-in-your-project) | | 229 | [What are the differences between Flux and Redux?](#what-are-the-differences-between-flux-and-redux) | | 230 | [What are the benefits of React Router V4?](#what-are-the-benefits-of-react-router-v4) | | 231 | [Can you describe about componentDidCatch lifecycle method signature?](#can-you-describe-about-componentdidcatch-lifecycle-method-signature) | | 232 | [In which scenarios error boundaries do not catch errors?](#in-which-scenarios-error-boundaries-do-not-catch-errors) | | 233 | [Why do you not need error boundaries for event handlers?](#why-do-you-not-need-error-boundaries-for-event-handlers) | | 234 | [What is the difference between try catch block and error boundaries?](#what-is-the-difference-between-try-catch-block-and-error-boundaries) | | 235 | [What is the behavior of uncaught errors in react 16?](#what-is-the-behavior-of-uncaught-errors-in-react-16) | | 236 | [What is the proper placement for error boundaries?](#what-is-the-proper-placement-for-error-boundaries) | | 237 | [What is the benefit of component stack trace from error boundary?](#what-is-the-benefit-of-component-stack-trace-from-error-boundary) | | 238 | [What is the required method to be defined for a class component?](#what-is-the-required-method-to-be-defined-for-a-class-component) | | 239 | [What are the possible return types of render method?](#what-are-the-possible-return-types-of-render-method) | | 240 | [What is the main purpose of constructor?](#what-is-the-main-purpose-of-constructor) | | 241 | [Is it mandatory to define constructor for React component?](#is-it-mandatory-to-define-constructor-for-react-component) | | 242 | [What are default props?](#what-are-default-props) | | 243 | [Why should not call setState in componentWillUnmount?](#why-should-not-call-setstate-in-componentwillunmount) | | 244 | [What is the purpose of getDerivedStateFromError?](#what-is-the-purpose-of-getderivedstatefromerror) | | 245 | [What is the methods order when component re-rendered?](#what-is-the-methods-order-when-component-re-rendered) | | 246 | [What are the methods invoked during error handling?](#what-are-the-methods-invoked-during-error-handling) | | 247 | [What is the purpose of displayName class property?](#what-is-the-purpose-of-displayname-class-property) | | 248 | [What is the browser support for react applications?](#what-is-the-browser-support-for-react-applications) | | 249 | [What is the purpose of unmountComponentAtNode method?](#what-is-the-purpose-of-unmountcomponentatnode-method) | | 250 | [What is code-splitting?](#what-is-code-splitting) | | 251 | [What is the benefit of strict mode?](#what-is-the-benefit-of-strict-mode) | | 252 | [What are Keyed Fragments?](#what-are-keyed-fragments) | | 253 | [Does React support all HTML attributes?](#does-react-support-all-html-attributes) | | 254 | [What are the limitations with HOCs?](#what-are-the-limitations-with-hocs) | | 255 | [How to debug forwardRefs in DevTools?](#how-to-debug-forwardrefs-in-devtools) | | 256 | [When component props defaults to true?](#when-component-props-defaults-to-true) | | 257 | [What is NextJS and major features of it?](#what-is-nextjs-and-major-features-of-it) | | 258 | [How do you pass an event handler to a component?](#how-do-you-pass-an-event-handler-to-a-component) | | 259 | [Is it good to use arrow functions in render methods?](#is-it-good-to-use-arrow-functions-in-render-methods) | | 260 | [How to prevent a function from being called multiple times?](#how-to-prevent-a-function-from-being-called-multiple-times) | | 261 | [How JSX prevents Injection Attacks?](#how-jsx-prevents-injection-attacks) | | 262 | [How do you update rendered elements?](#how-do-you-update-rendered-elements) | | 263 | [How do you say that props are read only?](#how-do-you-say-that-props-are-read-only) | | 264 | [How do you say that state updates are merged?](#how-do-you-say-that-state-updates-are-merged) | | 265 | [How do you pass arguments to an event handler?](#how-do-you-pass-arguments-to-an-event-handler) | | 266 | [How to prevent component from rendering?](#how-to-prevent-component-from-rendering) | | 267 | [What are the conditions to safely use the index as a key?](#what-are-the-conditions-to-safely-use-the-index-as-a-key) | | 268 | [Is it keys should be globally unique?](#is-it-keys-should-be-globally-unique) | | 269 | [What is the popular choice for form handling?](#what-is-the-popular-choice-for-form-handling) | | 270 | [What are the advantages of formik over redux form library?](#what-are-the-advantages-of-formik-over-redux-form-library) | | 271 | [Why do you not required to use inheritance?](#why-do-you-not-required-to-use-inheritance) | | 272 | [Can I use web components in react application?](#can-i-use-web-components-in-react-application) | | 273 | [What is dynamic import?](#what-is-dynamic-import) | | 274 | [What are loadable components?](#what-are-loadable-components) | | 275 | [What is suspense component?](#what-is-suspense-component) | | 276 | [What is route based code splitting?](#what-is-route-based-code-splitting) | | 277 | [Give an example on How to use context?](#give-an-example-on-how-to-use-context) | | 278 | [What is the purpose of default value in context?](#what-is-the-purpose-of-default-value-in-context) | | 279 | [How do you use contextType?](#how-do-you-use-contexttype) | | 280 | [What is a consumer?](#what-is-a-consumer) | | 281 | [How do you solve performance corner cases while using context?](#how-do-you-solve-performance-corner-cases-while-using-context) | | 282 | [What is the purpose of forward ref in HOCs?](#what-is-the-purpose-of-forward-ref-in-hocs) | | 283 | [Is it ref argument available for all functions or class components?](#is-it-ref-argument-available-for-all-functions-or-class-components) | | 284 | [Why do you need additional care for component libraries while using forward refs?](#why-do-you-need-additional-care-for-component-libraries-while-using-forward-refs) | | 285 | [How to create react class components without ES6?](#how-to-create-react-class-components-without-es6) | | 286 | [Is it possible to use react without JSX?](#is-it-possible-to-use-react-without-jsx) | | 287 | [What is diffing algorithm?](#what-is-diffing-algorithm) | | 288 | [What are the rules covered by diffing algorithm?](#what-are-the-rules-covered-by-diffing-algorithm) | | 289 | [When do you need to use refs?](#when-do-you-need-to-use-refs) | | 290 | [Is it prop must be named as render for render props?](#is-it-prop-must-be-named-as-render-for-render-props) | | 291 | [What are the problems of using render props with pure components?](#what-are-the-problems-of-using-render-props-with-pure-components) | | 292 | [How do you create HOC using render props?](#how-do-you-create-hoc-using-render-props) | | 293 | [What is windowing technique?](#what-is-windowing-technique) | | 294 | [How do you print falsy values in JSX?](#how-do-you-print-falsy-values-in-jsx) | | 295 | [What is the typical use case of portals?](#what-is-the-typical-use-case-of-portals) | | 296 | [How do you set default value for uncontrolled component?](#how-do-you-set-default-value-for-uncontrolled-component) | | 297 | [What is your favorite React stack?](#what-is-your-favorite-react-stack) | | 298 | [What is the difference between Real DOM and Virtual DOM?](#what-is-the-difference-between-real-dom-and-virtual-dom) | | 299 | [How to add Bootstrap to a react application?](#how-to-add-bootstrap-to-a-react-application) | | 300 | [Can you list down top websites or applications using react as front end framework?](#can-you-list-down-top-websites-or-applications-using-react-as-front-end-framework) | | 301 | [Is it recommended to use CSS In JS technique in React?](#is-it-recommended-to-use-css-in-js-technique-in-react) | | 302 | [Do I need to rewrite all my class components with hooks?](#do-i-need-to-rewrite-all-my-class-components-with-hooks) | | 303 | [How to fetch data with React Hooks?](#how-to-fetch-data-with-react-hooks) | | 304 | [Is Hooks cover all use cases for classes?](#is-hooks-cover-all-use-cases-for-classes) | | 305 | [What is the stable release for hooks support?](#what-is-the-stable-release-for-hooks-support) | | 306 | [Why do we use array destructuring (square brackets notation) in useState?](#why-do-we-use-array-destructuring-square-brackets-notation-in-usestate) | | 307 | [What are the sources used for introducing hooks?](#what-are-the-sources-used-for-introducing-hooks) | | 308 | [How do you access imperative API of web components?](#how-do-you-access-imperative-api-of-web-components) | | 309 | [What is formik?](#what-is-formik) | | 310 | [What are typical middleware choices for handling asynchronous calls in Redux?](#what-are-typical-middleware-choices-for-handling-asynchronous-calls-in-redux) | | 311 | [Do browsers understand JSX code?](#do-browsers-understand-jsx-code) | | 312 | [Describe about data flow in react?](#describe-about-data-flow-in-react) | | 313 | [What is react scripts?](#what-is-react-scripts) | | 314 | [What are the features of create react app?](#what-are-the-features-of-create-react-app) | | 315 | [What is the purpose of renderToNodeStream method?](#what-is-the-purpose-of-rendertonodestream-method) | | 316 | [What is MobX?](#what-is-mobx) | | 317 | [What are the differences between Redux and MobX?](#what-are-the-differences-between-redux-and-mobx) | | 318 | [Should I learn ES6 before learning ReactJS?](#should-i-learn-es6-before-learning-reactjs) | | 319 | [What is Concurrent Rendering?](#what-is-concurrent-rendering) | | 320 | [What is the difference between async mode and concurrent mode?](#what-is-the-difference-between-async-mode-and-concurrent-mode) | | 321 | [Can I use javascript urls in react16.9?](#can-i-use-javascript-urls-in-react169) | | 322 | [What is the purpose of eslint plugin for hooks?](#what-is-the-purpose-of-eslint-plugin-for-hooks) | | 323 | [What is the difference between Imperative and Declarative in React?](#what-is-the-difference-between-imperative-and-declarative-in-react) | | 324 | [What are the benefits of using typescript with reactjs?](#what-are-the-benefits-of-using-typescript-with-reactjs) | | 325 | [How do you make sure that user remains authenticated on page refresh while using Context API State Management?](#how-do-you-make-sure-that-user-remains-authenticated-on-page-refresh-while-using-context-api-state-management) | | 326 | [What are the benefits of new JSX transform?](#what-are-the-benefits-of-new-jsx-transform) | | 327 | [How is the new JSX transform different from old transform?](#how-is-the-new-jsx-transform-different-from-old-transform) | | 328 | [How do you get redux scaffolding using create-react-app?](#how-do-you-get-redux-scaffolding-using-create-react-app) | | 329 | [What are React Server components?](#what-are-react-server-components) | | 330 | [What is prop drilling?](#what-is-prop-drilling) | | 331 | [What is state mutation and how to prevent it?](#what-is-state-mutation-and-how-to-prevent-it) | | 332 | [What is the difference between useState and useRef hook?](#what-is-the-difference-between-usestate-and-useref-hook) | | 333 | [What is a wrapper component ](#what-is-a-wrapper-component) | | 334 | [What are the differences between useEffect and useLayoutEffect hooks](#what-are-the-differences-between-useEffect-and-useLayoutEffect-hooks) | | 335 | [What are the differences between Functional and Class Components ](#what-are-the-differences-between-functional-and-class-components) | | 336 | [Why does strict mode render twice in React?](#why-does-strict-mode-render-twice-in-react) | ## Core React 1. ### What is React? React(aka React.js or ReactJS) is an **open-source front-end JavaScript library** that is used for building composable user interfaces, especially for single-page applications. It is used for handling view layer for web and mobile apps based on components in a declarative approach. React was created by [Jordan Walke](https://github.com/jordwalke), a software engineer working for Facebook. React was first deployed on Facebook's News Feed in 2011 and on Instagram in 2012. **[⬆ Back to Top](#table-of-contents)** 2. ### What is the history behind React evolution? The history of ReactJS started in 2010 with the creation of **XHP**. XHP is a PHP extension which improved the syntax of the language such that XML document fragments become valid PHP expressions and the primary purpose was used to create custom and reusable HTML elements. The main principle of this extension was to make front-end code easier to understand and to help avoid cross-site scripting attacks. The project was successful to prevent the malicious content submitted by the scrubbing user. But there was a different problem with XHP in which dynamic web applications require many roundtrips to the server, and XHP did not solve this problem. Also, the whole UI was re-rendered for small change in the application. Later, the initial prototype of React is created with the name **FaxJ** by Jordan inspired from XHP. Finally after sometime React has been introduced as a new library into JavaScript world. **Note:** JSX comes from the idea of XHP **[⬆ Back to Top](#table-of-contents)** 2. ### What are the major features of React? The major features of React are: - Uses **JSX** syntax, a syntax extension of JS that allows developers to write HTML in their JS code. - It uses **Virtual DOM** instead of Real DOM considering that Real DOM manipulations are expensive. - Supports **server-side rendering** which is useful for Search Engine Optimizations(SEO). - Follows **Unidirectional or one-way** data flow or data binding. - Uses **reusable/composable** UI components to develop the view. **[⬆ Back to Top](#table-of-contents)** 3. ### What is JSX? _JSX_ stands for _JavaScript XML_ and it is an XML-like syntax extension to ECMAScript. Basically it just provides the syntactic sugar for the `React.createElement(type, props, ...children)` function, giving us expressiveness of JavaScript along with HTML like template syntax. In the example below, the text inside `<h1>` tag is returned as JavaScript function to the render function. ```jsx harmony export default function App() { return ( <h1 className="greeting">{"Hello, this is a JSX Code!"}</h1> ); } ``` If you don't use JSX syntax then the respective JavaScript code should be written as below, ```javascript import { createElement } from 'react'; export default function App() { return createElement( 'h1', { className: 'greeting' }, 'Hello, this is a JSX Code!' ); } ``` <details><summary><b>See Class</b></summary> <p> ```jsx harmony class App extends React.Component { render() { return ( <h1 className="greeting">{"Hello, this is a JSX Code!"}</h1> ); } } ``` </p> </details> **Note:** JSX is stricter than HTML **[⬆ Back to Top](#table-of-contents)** 4. ### What is the difference between Element and Component? An _Element_ is a plain object describing what you want to appear on the screen in terms of the DOM nodes or other components. _Elements_ can contain other _Elements_ in their props. Creating a React element is cheap. Once an element is created, it cannot be mutated. The JavaScript representation(Without JSX) of React Element would be as follows: ```javascript const element = React.createElement("div", { id: "login-btn" }, "Login"); ``` and this element can be simiplified using JSX ```html <div id="login-btn">Login</div> ``` The above `React.createElement()` function returns an object as below: ``` { type: 'div', props: { children: 'Login', id: 'login-btn' } } ``` Finally, this element renders to the DOM using `ReactDOM.render()`. Whereas a **component** can be declared in several different ways. It can be a class with a `render()` method or it can be defined as a function. In either case, it takes props as an input, and returns a JSX tree as the output: ```javascript const Button = ({ handleLogin }) => ( <div id={"login-btn"} onClick={handleLogin}> Login </div> ); ``` Then JSX gets transpiled to a `React.createElement()` function tree: ```javascript const Button = ({ handleLogin }) => React.createElement( "div", { id: "login-btn", onClick: handleLogin }, "Login" ); ``` **[⬆ Back to Top](#table-of-contents)** 5. ### How to create components in React? Components are the building blocks of creating User Interfaces(UI) in React. There are two possible ways to create a component. 1. **Function Components:** This is the simplest way to create a component. Those are pure JavaScript functions that accept props object as the first parameter and return React elements to render the output: ```jsx harmony function Greeting({ message }) { return <h1>{`Hello, ${message}`}</h1>; } ``` 2. **Class Components:** You can also use ES6 class to define a component. The above function component can be written as a class component: ```jsx harmony class Greeting extends React.Component { render() { return <h1>{`Hello, ${this.props.message}`}</h1>; } } ``` **[⬆ Back to Top](#table-of-contents)** 6. ### When to use a Class Component over a Function Component? After the addition of Hooks(i.e. React 16.8 onwards) it is always recommended to use Function components over Class components in React. Because you could use state, lifecycle methods and other features that were only available in class component present in function component too. But even there are two reasons to use Class components over Function components. 1. If you need a React functionality whose Function component equivalent is not present yet, like Error Boundaries. 2. In older versions, If the component needs _state or lifecycle methods_ then you need to use class component. **Note:** You can also use reusable [react error boundary](https://github.com/bvaughn/react-error-boundary) third-party component without writing any class. i.e, No need to use class components for Error boundaries. The usage of Error boundaries from the above library is quite straight forward. ```jsx "use client"; import { ErrorBoundary } from "react-error-boundary"; <ErrorBoundary fallback={<div>Something went wrong</div>}> <ExampleApplication /> </ErrorBoundary> ``` **[⬆ Back to Top](#table-of-contents)** 7. ### What are Pure Components? Pure components are the components which render the same output for the same state and props. In function components, you can achieve these pure components through memoized `React.memo()` API wrapping around the component. This API prevents unnecessary re-renders by comparing the previous props and new props using shallow comparison. So it will be helpful for performance optimizations. But at the same time, it won't compare the previous state with the current state because function component itself prevents the unnecessary rendering by default when you set the same state again. The syntactic representation of memoized components looks like below, ```jsx const MemoizedComponent = memo(SomeComponent, arePropsEqual?); ``` Below is the example of how child component(i.e., EmployeeProfile) prevents re-renders for the same props passed by parent component(i.e.,EmployeeRegForm). ```jsx import { memo, useState } from 'react'; const EmployeeProfile = memo(function EmployeeProfile({ name, email }) { return (<> <p>Name:{name}</p> <p>Email: {email}</p> </>); }); export default function EmployeeRegForm() { const [name, setName] = useState(''); const [email, setEmail] = useState(''); return ( <> <label> Name: <input value={name} onChange={e => setName(e.target.value)} /> </label> <label> Email: <input value={email} onChange={e => setEmail(e.target.value)} /> </label> <hr/> <EmployeeProfile name={name}/> </> ); } ``` In the above code, the email prop has not been passed to child component. So there won't be any re-renders for email prop change. In class components, the components extending _`React.PureComponent`_ instead of _`React.Component`_ become the pure components. When props or state changes, _PureComponent_ will do a shallow comparison on both props and state by invoking `shouldComponentUpdate()` lifecycle method. **Note:** `React.memo()` is a higher-order component. **[⬆ Back to Top](#table-of-contents)** 8. ### What is state in React? _State_ of a component is an object that holds some information that may change over the lifetime of the component. The important point is whenever the state object changes, the component re-renders. It is always recommended to make our state as simple as possible and minimize the number of stateful components. ![state](images/state.jpg) Let's take an example of **User** component with message state. Here, **useState** hook has been used to add state to the User component and it returns an array with current state and function to update it. ```jsx harmony import React, { useState } from "react"; function User() { const [message, setMessage] = useState("Welcome to React world"); return ( <div> <h1>{message}</h1> </div> ); } ``` <details><summary><b>See Class</b></summary> <p> ```jsx harmony import React from 'react'; class User extends React.Component { constructor(props) { super(props); this.state = { message: "Welcome to React world", }; } render() { return ( <div> <h1>{this.state.message}</h1> </div> ); } } ``` </p> </details> State is similar to props, but it is private and fully controlled by the component ,i.e., it is not accessible to any other component till the owner component decides to pass it. **[⬆ Back to Top](#table-of-contents)** 9. ### What are props in React? _Props_ are inputs to components. They are single values or objects containing a set of values that are passed to components on creation similar to HTML-tag attributes. Here, the data is passed down from a parent component to a child component. The primary purpose of props in React is to provide following component functionality: 1. Pass custom data to your component. 2. Trigger state changes. 3. Use via `this.props.reactProp` inside component's `render()` method. For example, let us create an element with `reactProp` property: ```jsx harmony <Element reactProp={"1"} /> ``` This `reactProp` (or whatever you came up with) attribute name then becomes a property attached to React's native props object which originally already exists on all components created using React library. ```jsx harmony props.reactProp ``` For example, the usage of props in function component looks like below: ```jsx import React from "react"; import ReactDOM from "react-dom"; const ChildComponent = (props) => { return ( <div> <p>{props.name}</p> <p>{props.age}</p> </div> ); }; const ParentComponent = () => { return ( <div> <ChildComponent name="John" age="30" /> <ChildComponent name="Mary" age="25" /> </div> ); }; ``` The properties from props object can be accessed directly using destructing feature from ES6 (ECMAScript 2015). The above child component can be simplified like below. ```jsx harmony const ChildComponent = ({name, age}) => { return ( <div> <p>{name}</p> <p>{age}</p> </div> ); }; ``` <details><summary><b>See Class</b></summary> The Props accessed in Class Based Component as below ```jsx import React from "react"; import ReactDOM from "react-dom"; class ChildComponent extends React.Component { render() { return ( <div> <p>{this.props.name}</p> <p>{this.props.age}</p> </div> ); } } class ParentComponent extends React.Component { render() { return ( <div> <ChildComponent name="John" age="30" /> <ChildComponent name="Mary" age="25" /> </div> ); } } ``` </details> **[⬆ Back to Top](#table-of-contents)** 10. ### What is the difference between state and props? In React, both `state` and `props` are plain JavaScript objects and used to manage the data of a component, but they are used in different ways and have different characteristics. `state` is managed by the component itself and can be updated using the `setState()` function. Unlike props, state can be modified by the component and is used to manage the internal state of the component. Changes in the state trigger a re-render of the component and its children. `props` (short for "properties") are passed to a component by its parent component and are `read-only`, meaning that they cannot be modified by the component itself. props can be used to configure the behavior of a component and to pass data between components. **[⬆ Back to Top](#table-of-contents)** 11. ### Why should we not update the state directly? If you try to update the state directly then it won't re-render the component. ```javascript //Wrong this.state.message = "Hello world"; ``` Instead use `setState()` method. It schedules an update to a component's state object. When state changes, the component responds by re-rendering. ```javascript //Correct this.setState({ message: "Hello World" }); ``` **Note:** You can directly assign to the state object either in _constructor_ or using latest javascript's class field declaration syntax. **[⬆ Back to Top](#table-of-contents)** 12. ### What is the purpose of callback function as an argument of `setState()`? The callback function is invoked when setState finished and the component gets rendered. Since `setState()` is **asynchronous** the callback function is used for any post action. **Note:** It is recommended to use lifecycle method rather than this callback function. ```javascript setState({ name: "John" }, () => console.log("The name has updated and component re-rendered") ); ``` **[⬆ Back to Top](#table-of-contents)** 13. ### What is the difference between HTML and React event handling? Below are some of the main differences between HTML and React event handling, 1. In HTML, the event name usually represents in _lowercase_ as a convention: ```html <button onclick="activateLasers()"></button> ``` Whereas in React it follows _camelCase_ convention: ```jsx harmony <button onClick={activateLasers}> ``` 2. In HTML, you can return `false` to prevent default behavior: ```html <a href="#" onclick='console.log("The link was clicked."); return false;' /> ``` Whereas in React you must call `preventDefault()` explicitly: ```javascript function handleClick(event) { event.preventDefault(); console.log("The link was clicked."); } ``` 3. In HTML, you need to invoke the function by appending `()` Whereas in react you should not append `()` with the function name. (refer "activateLasers" function in the first point for example) **[⬆ Back to Top](#table-of-contents)** 14. ### How to bind methods or event handlers in JSX callbacks? There are 3 possible ways to achieve this in class components: 1. **Binding in Constructor:** In JavaScript classes, the methods are not bound by default. The same rule applies for React event handlers defined as class methods. Normally we bind them in constructor. ```javascript class User extends Component { constructor(props) { super(props); this.handleClick = this.handleClick.bind(this); } handleClick() { console.log("SingOut triggered"); } render() { return <button onClick={this.handleClick}>SingOut</button>; } } ``` 2. **Public class fields syntax:** If you don't like to use bind approach then _public class fields syntax_ can be used to correctly bind callbacks. The Create React App eanables this syntax by default. ```jsx harmony handleClick = () => { console.log("SingOut triggered", this); }; ``` ```jsx harmony <button onClick={this.handleClick}>SingOut</button> ``` 3. **Arrow functions in callbacks:** It is possible to use _arrow functions_ directly in the callbacks. ```jsx harmony handleClick() { console.log('SingOut triggered'); } render() { return <button onClick={() => this.handleClick()}>SignOut</button>; } ``` **Note:** If the callback is passed as prop to child components, those components might do an extra re-rendering. In those cases, it is preferred to go with `.bind()` or _public class fields syntax_ approach considering performance. **[⬆ Back to Top](#table-of-contents)** 15. ### How to pass a parameter to an event handler or callback? You can use an _arrow function_ to wrap around an _event handler_ and pass parameters: ```jsx harmony <button onClick={() => this.handleClick(id)} /> ``` This is an equivalent to calling `.bind`: ```jsx harmony <button onClick={this.handleClick.bind(this, id)} /> ``` Apart from these two approaches, you can also pass arguments to a function which is defined as arrow function ```jsx harmony <button onClick={this.handleClick(id)} />; handleClick = (id) => () => { console.log("Hello, your ticket number is", id); }; ``` **[⬆ Back to Top](#table-of-contents)** 16. ### What are synthetic events in React? `SyntheticEvent` is a cross-browser wrapper around the browser's native event. Its API is same as the browser's native event, including `stopPropagation()` and `preventDefault()`, except the events work identically across all browsers. The native events can be accessed directly from synthetic events using `nativeEvent` attribute. Let's take an example of BookStore title search component with the ability to get all native event properties ```js function BookStore() { handleTitleChange(e) { console.log('The new title is:', e.target.value); // 'e' represents synthetic event const nativeEvent = e.nativeEvent; console.log(nativeEvent); e.stopPropogation(); e.preventDefault(); } return <input name="title" onChange={handleTitleChange} /> } ``` **[⬆ Back to Top](#table-of-contents)** 17. ### What are inline conditional expressions? You can use either _if statements_ or _ternary expressions_ which are available from JS to conditionally render expressions. Apart from these approaches, you can also embed any expressions in JSX by wrapping them in curly braces and then followed by JS logical operator `&&`. ```jsx harmony <h1>Hello!</h1>; { messages.length > 0 && !isLogin ? ( <h2>You have {messages.length} unread messages.</h2> ) : ( <h2>You don't have unread messages.</h2> ); } ``` **[⬆ Back to Top](#table-of-contents)** 18. ### What is "key" prop and what is the benefit of using it in arrays of elements? A `key` is a special attribute you **should** include when mapping over arrays to render data. _Key_ prop helps React identify which items have changed, are added, or are removed. Keys should be unique among its siblings. Most often we use ID from our data as _key_: ```jsx harmony const todoItems = todos.map((todo) => <li key={todo.id}>{todo.text}</li>); ``` When you don't have stable IDs for rendered items, you may use the item _index_ as a _key_ as a last resort: ```jsx harmony const todoItems = todos.map((todo, index) => ( <li key={index}>{todo.text}</li> )); ``` **Note:** 1. Using _indexes_ for _keys_ is **not recommended** if the order of items may change. This can negatively impact performance and may cause issues with component state. 2. If you extract list item as separate component then apply _keys_ on list component instead of `li` tag. 3. There will be a warning message in the console if the `key` prop is not present on list items. 4. The key attribute accepts either string or number and internally convert it as string type. **[⬆ Back to Top](#table-of-contents)** 19. ### What is the use of refs? The _ref_ is used to return a reference to the element. They _should be avoided_ in most cases, however, they can be useful when you need a direct access to the DOM element or an instance of a component. **[⬆ Back to Top](#table-of-contents)** 20. ### How to create refs? There are two approaches 1. This is a recently added approach. _Refs_ are created using `React.createRef()` method and attached to React elements via the `ref` attribute. In order to use _refs_ throughout the component, just assign the _ref_ to the instance property within constructor. ```jsx harmony class MyComponent extends React.Component { constructor(props) { super(props); this.myRef = React.createRef(); } render() { return <div ref={this.myRef} />; } } ``` 2. You can also use ref callbacks approach regardless of React version. For example, the search bar component's input element is accessed as follows, ```jsx harmony class SearchBar extends Component { constructor(props) { super(props); this.txtSearch = null; this.state = { term: "" }; this.setInputSearchRef = (e) => { this.txtSearch = e; }; } onInputChange(event) { this.setState({ term: this.txtSearch.value }); } render() { return ( <input value={this.state.term} onChange={this.onInputChange.bind(this)} ref={this.setInputSearchRef} /> ); } } ``` You can also use _refs_ in function components using **closures**. **Note**: You can also use inline ref callbacks even though it is not a recommended approach. **[⬆ Back to Top](#table-of-contents)** 21. ### What are forward refs? _Ref forwarding_ is a feature that lets some components take a _ref_ they receive, and pass it further down to a child. ```jsx harmony const ButtonElement = React.forwardRef((props, ref) => ( <button ref={ref} className="CustomButton"> {props.children} </button> )); // Create ref to the DOM button: const ref = React.createRef(); <ButtonElement ref={ref}>{"Forward Ref"}</ButtonElement>; ``` **[⬆ Back to Top](#table-of-contents)** 22. ### Which is preferred option with in callback refs and findDOMNode()? It is preferred to use _callback refs_ over `findDOMNode()` API. Because `findDOMNode()` prevents certain improvements in React in the future. The **legacy** approach of using `findDOMNode`: ```javascript class MyComponent extends Component { componentDidMount() { findDOMNode(this).scrollIntoView(); } render() { return <div />; } } ``` The recommended approach is: ```javascript class MyComponent extends Component { constructor(props) { super(props); this.node = createRef(); } componentDidMount() { this.node.current.scrollIntoView(); } render() { return <div ref={this.node} />; } } ``` **[⬆ Back to Top](#table-of-contents)** 23. ### Why are String Refs legacy? If you worked with React before, you might be familiar with an older API where the `ref` attribute is a string, like `ref={'textInput'}`, and the DOM node is accessed as `this.refs.textInput`. We advise against it because _string refs have below issues_, and are considered legacy. String refs were **removed in React v16**. 1. They _force React to keep track of currently executing component_. This is problematic because it makes react module stateful, and thus causes weird errors when react module is duplicated in the bundle. 2. They are _not composable_ — if a library puts a ref on the passed child, the user can't put another ref on it. Callback refs are perfectly composable. 3. They _don't work with static analysis_ like Flow. Flow can't guess the magic that framework does to make the string ref appear on `this.refs`, as well as its type (which could be different). Callback refs are friendlier to static analysis. 4. It doesn't work as most people would expect with the "render callback" pattern (e.g. <DataGrid renderRow={this.renderRow} />) ```jsx harmony class MyComponent extends Component { renderRow = (index) => { // This won't work. Ref will get attached to DataTable rather than MyComponent: return <input ref={"input-" + index} />; // This would work though! Callback refs are awesome. return <input ref={(input) => (this["input-" + index] = input)} />; }; render() { return ( <DataTable data={this.props.data} renderRow={this.renderRow} /> ); } } ``` **[⬆ Back to Top](#table-of-contents)** 24. ### What is Virtual DOM? The _Virtual DOM_ (VDOM) is an in-memory representation of _Real DOM_. The representation of a UI is kept in memory and synced with the "real" DOM. It's a step that happens between the render function being called and the displaying of elements on the screen. This entire process is called _reconciliation_. **[⬆ Back to Top](#table-of-contents)** 25. ### How Virtual DOM works? The _Virtual DOM_ works in three simple steps. 1. Whenever any underlying data changes, the entire UI is re-rendered in Virtual DOM representation. ![vdom](images/vdom1.png) 2. Then the difference between the previous DOM representation and the new one is calculated. ![vdom2](images/vdom2.png) 3. Once the calculations are done, the real DOM will be updated with only the things that have actually changed. ![vdom3](images/vdom3.png) **[⬆ Back to Top](#table-of-contents)** 26. ### What is the difference between Shadow DOM and Virtual DOM? The _Shadow DOM_ is a browser technology designed primarily for scoping variables and CSS in _web components_. The _Virtual DOM_ is a concept implemented by libraries in JavaScript on top of browser APIs. **[⬆ Back to Top](#table-of-contents)** 27. ### What is React Fiber? Fiber is the new _reconciliation_ engine or reimplementation of core algorithm in React v16. The goal of React Fiber is to increase its suitability for areas like animation, layout, gestures, ability to pause, abort, or reuse work and assign priority to different types of updates; and new concurrency primitives. **[⬆ Back to Top](#table-of-contents)** 28. ### What is the main goal of React Fiber? The goal of _React Fiber_ is to increase its suitability for areas like animation, layout, and gestures. Its headline feature is **incremental rendering**: the ability to split rendering work into chunks and spread it out over multiple frames. _from documentation_ Its main goals are: 1. Ability to split interruptible work in chunks. 2. Ability to prioritize, rebase and reuse work in progress. 3. Ability to yield back and forth between parents and children to support layout in React. 4. Ability to return multiple elements from render(). 5. Better support for error boundaries. **[⬆ Back to Top](#table-of-contents)** 29. ### What are controlled components? A component that controls the input elements within the forms on subsequent user input is called **Controlled Component**, i.e, every state mutation will have an associated handler function. For example, to write all the names in uppercase letters, we use handleChange as below, ```javascript handleChange(event) { this.setState({value: event.target.value.toUpperCase()}) } ``` **[⬆ Back to Top](#table-of-contents)** 30. ### What are uncontrolled components? The **Uncontrolled Components** are the ones that store their own state internally, and you query the DOM using a ref to find its current value when you need it. This is a bit more like traditional HTML. In the below UserProfile component, the `name` input is accessed using ref. ```jsx harmony class UserProfile extends React.Component { constructor(props) { super(props); this.handleSubmit = this.handleSubmit.bind(this); this.input = React.createRef(); } handleSubmit(event) { alert("A name was submitted: " + this.input.current.value); event.preventDefault(); } render() { return ( <form onSubmit={this.handleSubmit}> <label> {"Name:"} <input type="text" ref={this.input} /> </label> <input type="submit" value="Submit" /> </form> ); } } ``` In most cases, it's recommend to use controlled components to implement forms. In a controlled component, form data is handled by a React component. The alternative is uncontrolled components, where form data is handled by the DOM itself. **[⬆ Back to Top](#table-of-contents)** 31. ### What is the difference between createElement and cloneElement? JSX elements will be transpiled to `React.createElement()` functions to create React elements which are going to be used for the object representation of UI. Whereas `cloneElement` is used to clone an element and pass it new props. **[⬆ Back to Top](#table-of-contents)** 32. ### What is Lifting State Up in React? When several components need to share the same changing data then it is recommended to _lift the shared state up_ to their closest common ancestor. That means if two child components share the same data from its parent, then move the state to parent instead of maintaining local state in both of the child components. **[⬆ Back to Top](#table-of-contents)** 33. ### What are the different phases of component lifecycle? The component lifecycle has three distinct lifecycle phases: 1. **Mounting:** The component is ready to mount in the browser DOM. This phase covers initialization from `constructor()`, `getDerivedStateFromProps()`, `render()`, and `componentDidMount()` lifecycle methods. 2. **Updating:** In this phase, the component gets updated in two ways, sending the new props and updating the state either from `setState()` or `forceUpdate()`. This phase covers `getDerivedStateFromProps()`, `shouldComponentUpdate()`, `render()`, `getSnapshotBeforeUpdate()` and `componentDidUpdate()` lifecycle methods. 3. **Unmounting:** In this last phase, the component is not needed and gets unmounted from the browser DOM. This phase includes `componentWillUnmount()` lifecycle method. It's worth mentioning that React internally has a concept of phases when applying changes to the DOM. They are separated as follows 1. **Render** The component will render without any side effects. This applies to Pure components and in this phase, React can pause, abort, or restart the render. 2. **Pre-commit** Before the component actually applies the changes to the DOM, there is a moment that allows React to read from the DOM through the `getSnapshotBeforeUpdate()`. 3. **Commit** React works with the DOM and executes the final lifecycles respectively `componentDidMount()` for mounting, `componentDidUpdate()` for updating, and `componentWillUnmount()` for unmounting. React 16.3+ Phases (or an [interactive version](http://projects.wojtekmaj.pl/react-lifecycle-methods-diagram/)) ![phases 16.4+](images/phases16.4.png) Before React 16.3 ![phases 16.2](images/phases.png) **[⬆ Back to Top](#table-of-contents)** 34. ### What are the lifecycle methods of React? Before React 16.3 - **componentWillMount:** Executed before rendering and is used for App level configuration in your root component. - **componentDidMount:** Executed after first rendering and here all AJAX requests, DOM or state updates, and set up event listeners should occur. - **componentWillReceiveProps:** Executed when particular prop updates to trigger state transitions. - **shouldComponentUpdate:** Determines if the component will be updated or not. By default it returns `true`. If you are sure that the component doesn't need to render after state or props are updated, you can return false value. It is a great place to improve performance as it allows you to prevent a re-render if component receives new prop. - **componentWillUpdate:** Executed before re-rendering the component when there are props & state changes confirmed by `shouldComponentUpdate()` which returns true. - **componentDidUpdate:** Mostly it is used to update the DOM in response to prop or state changes. - **componentWillUnmount:** It will be used to cancel any outgoing network requests, or remove all event listeners associated with the component. React 16.3+ - **getDerivedStateFromProps:** Invoked right before calling `render()` and is invoked on _every_ render. This exists for rare use cases where you need a derived state. Worth reading [if you need derived state](https://reactjs.org/blog/2018/06/07/you-probably-dont-need-derived-state.html). - **componentDidMount:** Executed after first rendering and where all AJAX requests, DOM or state updates, and set up event listeners should occur. - **shouldComponentUpdate:** Determines if the component will be updated or not. By default, it returns `true`. If you are sure that the component doesn't need to render after the state or props are updated, you can return a false value. It is a great place to improve performance as it allows you to prevent a re-render if component receives a new prop. - **getSnapshotBeforeUpdate:** Executed right before rendered output is committed to the DOM. Any value returned by this will be passed into `componentDidUpdate()`. This is useful to capture information from the DOM i.e. scroll position. - **componentDidUpdate:** Mostly it is used to update the DOM in response to prop or state changes. This will not fire if `shouldComponentUpdate()` returns `false`. - **componentWillUnmount** It will be used to cancel any outgoing network requests, or remove all event listeners associated with the component. **[⬆ Back to Top](#table-of-contents)** 35. ### What are Higher-Order Components? A _higher-order component_ (_HOC_) is a function that takes a component and returns a new component. Basically, it's a pattern that is derived from React's compositional nature. We call them **pure components** because they can accept any dynamically provided child component but they won't modify or copy any behavior from their input components. ```javascript const EnhancedComponent = higherOrderComponent(WrappedComponent); ``` HOC can be used for many use cases: 1. Code reuse, logic and bootstrap abstraction. 2. Render hijacking. 3. State abstraction and manipulation. 4. Props manipulation. **[⬆ Back to Top](#table-of-contents)** 36. ### How to create props proxy for HOC component? You can add/edit props passed to the component using _props proxy_ pattern like this: ```jsx harmony function HOC(WrappedComponent) { return class Test extends Component { render() { const newProps = { title: "New Header", footer: false, showFeatureX: false, showFeatureY: true, }; return <WrappedComponent {...this.props} {...newProps} />; } }; } ``` **[⬆ Back to Top](#table-of-contents)** 37. ### What is context? _Context_ provides a way to pass data through the component tree without having to pass props down manually at every level. For example, authenticated users, locale preferences, UI themes need to be accessed in the application by many components. ```javascript const { Provider, Consumer } = React.createContext(defaultValue); ``` **[⬆ Back to Top](#table-of-contents)** 38. ### What is children prop? _Children_ is a prop (`this.props.children`) that allows you to pass components as data to other components, just like any other prop you use. Component tree put between component's opening and closing tag will be passed to that component as `children` prop. There are several methods available in the React API to work with this prop. These include `React.Children.map`, `React.Children.forEach`, `React.Children.count`, `React.Children.only`, `React.Children.toArray`. A simple usage of children prop looks as below, ```jsx harmony const MyDiv = React.createClass({ render: function () { return <div>{this.props.children}</div>; }, }); ReactDOM.render( <MyDiv> <span>{"Hello"}</span> <span>{"World"}</span> </MyDiv>, node ); ``` **[⬆ Back to Top](#table-of-contents)** 39. ### How to write comments in React? The comments in React/JSX are similar to JavaScript Multiline comments but are wrapped in curly braces. **Single-line comments:** ```jsx harmony <div> {/* Single-line comments(In vanilla JavaScript, the single-line comments are represented by double slash(//)) */} {`Welcome ${user}, let's play React`} </div> ``` **Multi-line comments:** ```jsx harmony <div> {/* Multi-line comments for more than one line */} {`Welcome ${user}, let's play React`} </div> ``` **[⬆ Back to Top](#table-of-contents)** 40. ### What is the purpose of using super constructor with props argument? A child class constructor cannot make use of `this` reference until the `super()` method has been called. The same applies to ES6 sub-classes as well. The main reason for passing props parameter to `super()` call is to access `this.props` in your child constructors. **Passing props:** ```javascript class MyComponent extends React.Component { constructor(props) { super(props); console.log(this.props); // prints { name: 'John', age: 42 } } } ``` **Not passing props:** ```javascript class MyComponent extends React.Component { constructor(props) { super(); console.log(this.props); // prints undefined // but props parameter is still available console.log(props); // prints { name: 'John', age: 42 } } render() { // no difference outside constructor console.log(this.props); // prints { name: 'John', age: 42 } } } ``` The above code snippets reveals that `this.props` is different only within the constructor. It would be the same outside the constructor. **[⬆ Back to Top](#table-of-contents)** 41. ### What is reconciliation? `Reconciliation` is the process through which React updates the Browser DOM and makes React work faster. React use a `diffing algorithm` so that component updates are predictable and faster. React would first calculate the difference between the `real DOM` and the copy of DOM `(Virtual DOM)` when there's an update of components. React stores a copy of Browser DOM which is called `Virtual DOM`. When we make changes or add data, React creates a new Virtual DOM and compares it with the previous one. This comparison is done by `Diffing Algorithm`. Now React compares the Virtual DOM with Real DOM. It finds out the changed nodes and updates only the changed nodes in Real DOM leaving the rest nodes as it is. This process is called _Reconciliation_. **[⬆ Back to Top](#table-of-contents)** 42. ### How to set state with a dynamic key name? If you are using ES6 or the Babel transpiler to transform your JSX code then you can accomplish this with _computed property names_. ```javascript handleInputChange(event) { this.setState({ [event.target.id]: event.target.value }) } ``` **[⬆ Back to Top](#table-of-contents)** 43. ### What would be the common mistake of function being called every time the component renders? You need to make sure that function is not being called while passing the function as a parameter. ```jsx harmony render() { // Wrong: handleClick is called instead of passed as a reference! return <button onClick={this.handleClick()}>{'Click Me'}</button> } ``` Instead, pass the function itself without parenthesis: ```jsx harmony render() { // Correct: handleClick is passed as a reference! return <button onClick={this.handleClick}>{'Click Me'}</button> } ``` **[⬆ Back to Top](#table-of-contents)** 44. ### Is lazy function supports named exports? No, currently `React.lazy` function supports default exports only. If you would like to import modules which are named exports, you can create an intermediate module that reexports it as the default. It also ensures that tree shaking keeps working and don’t pull unused components. Let's take a component file which exports multiple named components, ```javascript // MoreComponents.js export const SomeComponent = /* ... */; export const UnusedComponent = /* ... */; ``` and reexport `MoreComponents.js` components in an intermediate file `IntermediateComponent.js` ```javascript // IntermediateComponent.js export { SomeComponent as default } from "./MoreComponents.js"; ``` Now you can import the module using lazy function as below, ```javascript import React, { lazy } from "react"; const SomeComponent = lazy(() => import("./IntermediateComponent.js")); ``` **[⬆ Back to Top](#table-of-contents)** 45. ### Why React uses `className` over `class` attribute? The attribute `class` is a keyword in JavaScript, and JSX is an extension of JavaScript. That's the principal reason why React uses `className` instead of `class`. Pass a string as the `className` prop. ```jsx harmony render() { return <span className={'menu navigation-menu'}>{'Menu'}</span> } ``` **[⬆ Back to Top](#table-of-contents)** 46. ### What are fragments? It's a common pattern or practice in React for a component to return multiple elements. _Fragments_ let you group a list of children without adding extra nodes to the DOM. You need to use either **<Fragment>** or a shorter syntax having empty tag (**<></>**). Below is the example of how to use fragment inside _Story_ component. ```jsx harmony function Story({title, description, date}) { return ( <Fragment> <h2>{title}</h2> <p>{description}</p> <p>{date}</p> </Fragment> ); } ``` It is also possible to render list of fragments inside a loop with the mandatory **key** attribute supplied. ```jsx harmony function StoryBook() { return stories.map(story => <Fragment key={ story.id}> <h2>{story.title}</h2> <p>{story.description}</p> <p>{story.date}</p> </Fragment> ); } ``` Ususally you don't need to use **<Fragment>** until unless there is a need of _key_ attribute. The usage of shorter syntax looks like below. ```jsx harmony function Story({title, description, date}) { return ( <> <h2>{title}</h2> <p>{description}</p> <p>{date}</p> </> ); } ``` **[⬆ Back to Top](#table-of-contents)** 47. ### Why fragments are better than container divs? Below are the list of reasons to prefer fragments over container DOM elements, 1. Fragments are a bit faster and use less memory by not creating an extra DOM node. This only has a real benefit on very large and deep trees. 2. Some CSS mechanisms like _Flexbox_ and _CSS Grid_ have a special parent-child relationships, and adding divs in the middle makes it hard to keep the desired layout. 3. The DOM Inspector is less cluttered. **[⬆ Back to Top](#table-of-contents)** 48. ### What are portals in React? _Portal_ is a recommended way to render children into a DOM node that exists outside the DOM hierarchy of the parent component. ```javascript ReactDOM.createPortal(child, container); ``` The first argument is any render-able React child, such as an element, string, or fragment. The second argument is a DOM element. **[⬆ Back to Top](#table-of-contents)** 49. ### What are stateless components? If the behaviour of a component is independent of its state then it can be a stateless component. You can use either a function or a class for creating stateless components. But unless you need to use a lifecycle hook in your components, you should go for function components. There are a lot of benefits if you decide to use function components here; they are easy to write, understand, and test, a little faster, and you can avoid the `this` keyword altogether. **[⬆ Back to Top](#table-of-contents)** 50. ### What are stateful components? If the behaviour of a component is dependent on the _state_ of the component then it can be termed as stateful component. These _stateful components_ are either function components with hooks or _class components_. Let's take an example of function stateful component which update the state based on click event, ```javascript import React, {useState} from 'react'; const App = (props) => { const [count, setCount] = useState(0); handleIncrement() { setCount(count+1); } return ( <> <button onClick={handleIncrement}>Increment</button> <span>Counter: {count}</span> </> ) } ``` <details><summary><b>See Class</b></summary> <p> The equivalent class stateful component with a state that gets initialized in the `constructor`. ```jsx harmony class App extends Component { constructor(props) { super(props); this.state = { count: 0 }; } handleIncrement() { setState({count: this.state.count + 1}) } render() { <> <button onClick={() => this.handleIncrement}>Increment</button> <span>Count: {count}</span> </> } } ``` </p> </details> **[⬆ Back to Top](#table-of-contents)** 51. ### How to apply validation on props in React? When the application is running in _development mode_, React will automatically check all props that we set on components to make sure they have _correct type_. If the type is incorrect, React will generate warning messages in the console. It's disabled in _production mode_ due to performance impact. The mandatory props are defined with `isRequired`. The set of predefined prop types: 1. `PropTypes.number` 2. `PropTypes.string` 3. `PropTypes.array` 4. `PropTypes.object` 5. `PropTypes.func` 6. `PropTypes.node` 7. `PropTypes.element` 8. `PropTypes.bool` 9. `PropTypes.symbol` 10. `PropTypes.any` We can define `propTypes` for `User` component as below: ```jsx harmony import React from "react"; import PropTypes from "prop-types"; class User extends React.Component { static propTypes = { name: PropTypes.string.isRequired, age: PropTypes.number.isRequired, }; render() { return ( <> <h1>{`Welcome, ${this.props.name}`}</h1> <h2>{`Age, ${this.props.age}`}</h2> </> ); } } ``` **Note:** In React v15.5 _PropTypes_ were moved from `React.PropTypes` to `prop-types` library. _The Equivalent Functional Component_ ```jsx harmony import React from "react"; import PropTypes from "prop-types"; function User({ name, age }) { return ( <> <h1>{`Welcome, ${name}`}</h1> <h2>{`Age, ${age}`}</h2> </> ); } User.propTypes = { name: PropTypes.string.isRequired, age: PropTypes.number.isRequired, }; ``` **[⬆ Back to Top](#table-of-contents)** 52. ### What are the advantages of React? Below are the list of main advantages of React, 1. Increases the application's performance with _Virtual DOM_. 2. JSX makes code easy to read and write. 3. It renders both on client and server side (_SSR_). 4. Easy to integrate with frameworks (Angular, Backbone) since it is only a view library. 5. Easy to write unit and integration tests with tools such as Jest. **[⬆ Back to Top](#table-of-contents)** 53. ### What are the limitations of React? Apart from the advantages, there are few limitations of React too, 1. React is just a view library, not a full framework. 2. There is a learning curve for beginners who are new to web development. 3. Integrating React into a traditional MVC framework requires some additional configuration. 4. The code complexity increases with inline templating and JSX. 5. Too many smaller components leading to over engineering or boilerplate. **[⬆ Back to Top](#table-of-contents)** 54. ### What are error boundaries in React v16? _Error boundaries_ are components that catch JavaScript errors anywhere in their child component tree, log those errors, and display a fallback UI instead of the component tree that crashed. A class component becomes an error boundary if it defines a new lifecycle method called `componentDidCatch(error, info)` or `static getDerivedStateFromError() `: ```jsx harmony class ErrorBoundary extends React.Component { constructor(props) { super(props); this.state = { hasError: false }; } componentDidCatch(error, info) { // You can also log the error to an error reporting service logErrorToMyService(error, info); } static getDerivedStateFromError(error) { // Update state so the next render will show the fallback UI. return { hasError: true }; } render() { if (this.state.hasError) { // You can render any custom fallback UI return <h1>{"Something went wrong."}</h1>; } return this.props.children; } } ``` After that use it as a regular component: ```jsx harmony <ErrorBoundary> <MyWidget /> </ErrorBoundary> ``` **[⬆ Back to Top](#table-of-contents)** 55. ### How are error boundaries handled in React v15? React v15 provided very basic support for _error boundaries_ using `unstable_handleError` method. It has been renamed to `componentDidCatch` in React v16. **[⬆ Back to Top](#table-of-contents)** 56. ### What are the recommended ways for static type checking? Normally we use _PropTypes library_ (`React.PropTypes` moved to a `prop-types` package since React v15.5) for _type checking_ in the React applications. For large code bases, it is recommended to use _static type checkers_ such as Flow or TypeScript, that perform type checking at compile time and provide auto-completion features. **[⬆ Back to Top](#table-of-contents)** 57. ### What is the use of `react-dom` package? The `react-dom` package provides _DOM-specific methods_ that can be used at the top level of your app. Most of the components are not required to use this module. Some of the methods of this package are: 1. `render()` 2. `hydrate()` 3. `unmountComponentAtNode()` 4. `findDOMNode()` 5. `createPortal()` **[⬆ Back to Top](#table-of-contents)** 58. ### What is the purpose of render method of `react-dom`? This method is used to render a React element into the DOM in the supplied container and return a reference to the component. If the React element was previously rendered into container, it will perform an update on it and only mutate the DOM as necessary to reflect the latest changes. ``` ReactDOM.render(element, container, [callback]) ``` If the optional callback is provided, it will be executed after the component is rendered or updated. **[⬆ Back to Top](#table-of-contents)** 59. ### What is ReactDOMServer? The `ReactDOMServer` object enables you to render components to static markup (typically used on node server). This object is mainly used for _server-side rendering_ (SSR). The following methods can be used in both the server and browser environments: 1. `renderToString()` 2. `renderToStaticMarkup()` For example, you generally run a Node-based web server like Express, Hapi, or Koa, and you call `renderToString` to render your root component to a string, which you then send as response. ```javascript // using Express import { renderToString } from "react-dom/server"; import MyPage from "./MyPage"; app.get("/", (req, res) => { res.write( "<!DOCTYPE html><html><head><title>My Page</title></head><body>" ); res.write('<div id="content">'); res.write(renderToString(<MyPage />)); res.write("</div></body></html>"); res.end(); }); ``` **[⬆ Back to Top](#table-of-contents)** 60. ### How to use innerHTML in React? The `dangerouslySetInnerHTML` attribute is React's replacement for using `innerHTML` in the browser DOM. Just like `innerHTML`, it is risky to use this attribute considering cross-site scripting (XSS) attacks. You just need to pass a `__html` object as key and HTML text as value. In this example MyComponent uses `dangerouslySetInnerHTML` attribute for setting HTML markup: ```jsx harmony function createMarkup() { return { __html: "First &middot; Second" }; } function MyComponent() { return <div dangerouslySetInnerHTML={createMarkup()} />; } ``` **[⬆ Back to Top](#table-of-contents)** 61. ### How to use styles in React? The `style` attribute accepts a JavaScript object with camelCased properties rather than a CSS string. This is consistent with the DOM style JavaScript property, is more efficient, and prevents XSS security holes. ```jsx harmony const divStyle = { color: "blue", backgroundImage: "url(" + imgUrl + ")", }; function HelloWorldComponent() { return <div style={divStyle}>Hello World!</div>; } ``` Style keys are camelCased in order to be consistent with accessing the properties on DOM nodes in JavaScript (e.g. `node.style.backgroundImage`). **[⬆ Back to Top](#table-of-contents)** 62. ### How events are different in React? Handling events in React elements has some syntactic differences: 1. React event handlers are named using camelCase, rather than lowercase. 2. With JSX you pass a function as the event handler, rather than a string. **[⬆ Back to Top](#table-of-contents)** 63. ### What will happen if you use `setState()` in constructor? When you use `setState()`, then apart from assigning to the object state React also re-renders the component and all its children. You would get error like this: _Can only update a mounted or mounting component._ So we need to use `this.state` to initialize variables inside constructor. **[⬆ Back to Top](#table-of-contents)** 64. ### What is the impact of indexes as keys? Keys should be stable, predictable, and unique so that React can keep track of elements. In the below code snippet each element's key will be based on ordering, rather than tied to the data that is being represented. This limits the optimizations that React can do. ```jsx harmony { todos.map((todo, index) => <Todo {...todo} key={index} />); } ``` If you use element data for unique key, assuming todo.id is unique to this list and stable, React would be able to reorder elements without needing to reevaluate them as much. ```jsx harmony { todos.map((todo) => <Todo {...todo} key={todo.id} />); } ``` **[⬆ Back to Top](#table-of-contents)** 65. ### Is it good to use `setState()` in `componentWillMount()` method? Yes, it is safe to use `setState()` inside `componentWillMount()` method. But at the same it is recommended to avoid async initialization in `componentWillMount()` lifecycle method. `componentWillMount()` is invoked immediately before mounting occurs. It is called before `render()`, therefore setting state in this method will not trigger a re-render. Avoid introducing any side-effects or subscriptions in this method. We need to make sure async calls for component initialization happened in `componentDidMount()` instead of `componentWillMount()`. ```jsx harmony componentDidMount() { axios.get(`api/todos`) .then((result) => { this.setState({ messages: [...result.data] }) }) } ``` **[⬆ Back to Top](#table-of-contents)** 66. ### What will happen if you use props in initial state? If the props on the component are changed without the component being refreshed, the new prop value will never be displayed because the constructor function will never update the current state of the component. The initialization of state from props only runs when the component is first created. The below component won't display the updated input value: ```jsx harmony class MyComponent extends React.Component { constructor(props) { super(props); this.state = { records: [], inputValue: this.props.inputValue, }; } render() { return <div>{this.state.inputValue}</div>; } } ``` Using props inside render method will update the value: ```jsx harmony class MyComponent extends React.Component { constructor(props) { super(props); this.state = { record: [], }; } render() { return <div>{this.props.inputValue}</div>; } } ``` **[⬆ Back to Top](#table-of-contents)** 67. ### How do you conditionally render components? In some cases you want to render different components depending on some state. JSX does not render `false` or `undefined`, so you can use conditional _short-circuiting_ to render a given part of your component only if a certain condition is true. ```jsx harmony const MyComponent = ({ name, address }) => ( <div> <h2>{name}</h2> {address && <p>{address}</p>} </div> ); ``` If you need an `if-else` condition then use _ternary operator_. ```jsx harmony const MyComponent = ({ name, address }) => ( <div> <h2>{name}</h2> {address ? <p>{address}</p> : <p>{"Address is not available"}</p>} </div> ); ``` **[⬆ Back to Top](#table-of-contents)** 68. ### Why we need to be careful when spreading props on DOM elements? When we _spread props_ we run into the risk of adding unknown HTML attributes, which is a bad practice. Instead we can use prop destructuring with `...rest` operator, so it will add only required props. For example, ```jsx harmony const ComponentA = () => ( <ComponentB isDisplay={true} className={"componentStyle"} /> ); const ComponentB = ({ isDisplay, ...domProps }) => ( <div {...domProps}>{"ComponentB"}</div> ); ``` **[⬆ Back to Top](#table-of-contents)** 69. ### How you use decorators in React? You can _decorate_ your _class_ components, which is the same as passing the component into a function. **Decorators** are flexible and readable way of modifying component functionality. ```jsx harmony @setTitle("Profile") class Profile extends React.Component { //.... } /* title is a string that will be set as a document title WrappedComponent is what our decorator will receive when put directly above a component class as seen in the example above */ const setTitle = (title) => (WrappedComponent) => { return class extends React.Component { componentDidMount() { document.title = title; } render() { return <WrappedComponent {...this.props} />; } }; }; ``` **Note:** Decorators are a feature that didn't make it into ES7, but are currently a _stage 2 proposal_. **[⬆ Back to Top](#table-of-contents)** 70. ### How do you memoize a component? There are memoize libraries available which can be used on function components. For example `moize` library can memoize the component in another component. ```jsx harmony import moize from "moize"; import Component from "./components/Component"; // this module exports a non-memoized component const MemoizedFoo = moize.react(Component); const Consumer = () => { <div> {"I will memoize the following entry:"} <MemoizedFoo /> </div>; }; ``` **Update:** Since React v16.6.0, we have a `React.memo`. It provides a higher order component which memoizes component unless the props change. To use it, simply wrap the component using React.memo before you use it. ```js const MemoComponent = React.memo(function MemoComponent(props) { /* render using props */ }); OR; export default React.memo(MyFunctionComponent); ``` **[⬆ Back to Top](#table-of-contents)** 71. ### How you implement Server Side Rendering or SSR? React is already equipped to handle rendering on Node servers. A special version of the DOM renderer is available, which follows the same pattern as on the client side. ```jsx harmony import ReactDOMServer from "react-dom/server"; import App from "./App"; ReactDOMServer.renderToString(<App />); ``` This method will output the regular HTML as a string, which can be then placed inside a page body as part of the server response. On the client side, React detects the pre-rendered content and seamlessly picks up where it left off. **[⬆ Back to Top](#table-of-contents)** 72. ### How to enable production mode in React? You should use Webpack's `DefinePlugin` method to set `NODE_ENV` to `production`, by which it strip out things like propType validation and extra warnings. Apart from this, if you minify the code, for example, Uglify's dead-code elimination to strip out development only code and comments, it will drastically reduce the size of your bundle. **[⬆ Back to Top](#table-of-contents)** 73. ### What is CRA and its benefits? The `create-react-app` CLI tool allows you to quickly create & run React applications with no configuration step. Let's create Todo App using _CRA_: ```console # Installation $ npm install -g create-react-app # Create new project $ create-react-app todo-app $ cd todo-app # Build, test and run $ npm run build $ npm run test $ npm start ``` It includes everything we need to build a React app: 1. React, JSX, ES6, and Flow syntax support. 2. Language extras beyond ES6 like the object spread operator. 3. Autoprefixed CSS, so you don’t need -webkit- or other prefixes. 4. A fast interactive unit test runner with built-in support for coverage reporting. 5. A live development server that warns about common mistakes. 6. A build script to bundle JS, CSS, and images for production, with hashes and sourcemaps. **[⬆ Back to Top](#table-of-contents)** 74. ### What is the lifecycle methods order in mounting? The lifecycle methods are called in the following order when an instance of a component is being created and inserted into the DOM. 1. `constructor()` 2. `static getDerivedStateFromProps()` 3. `render()` 4. `componentDidMount()` **[⬆ Back to Top](#table-of-contents)** 75. ### What are the lifecycle methods going to be deprecated in React v16? The following lifecycle methods going to be unsafe coding practices and will be more problematic with async rendering. 1. `componentWillMount()` 2. `componentWillReceiveProps()` 3. `componentWillUpdate()` Starting with React v16.3 these methods are aliased with `UNSAFE_` prefix, and the unprefixed version will be removed in React v17. **[⬆ Back to Top](#table-of-contents)** 76. ### What is the purpose of `getDerivedStateFromProps()` lifecycle method? The new static `getDerivedStateFromProps()` lifecycle method is invoked after a component is instantiated as well as before it is re-rendered. It can return an object to update state, or `null` to indicate that the new props do not require any state updates. ```javascript class MyComponent extends React.Component { static getDerivedStateFromProps(props, state) { // ... } } ``` This lifecycle method along with `componentDidUpdate()` covers all the use cases of `componentWillReceiveProps()`. **[⬆ Back to Top](#table-of-contents)** 77. ### What is the purpose of `getSnapshotBeforeUpdate()` lifecycle method? The new `getSnapshotBeforeUpdate()` lifecycle method is called right before DOM updates. The return value from this method will be passed as the third parameter to `componentDidUpdate()`. ```javascript class MyComponent extends React.Component { getSnapshotBeforeUpdate(prevProps, prevState) { // ... } } ``` This lifecycle method along with `componentDidUpdate()` covers all the use cases of `componentWillUpdate()`. **[⬆ Back to Top](#table-of-contents)** 78. ### Do Hooks replace render props and higher order components? Both render props and higher-order components render only a single child but in most of the cases Hooks are a simpler way to serve this by reducing nesting in your tree. **[⬆ Back to Top](#table-of-contents)** 79. ### What is the recommended way for naming components? It is recommended to name the component by reference instead of using `displayName`. Using `displayName` for naming component: ```javascript export default React.createClass({ displayName: "TodoApp", // ... }); ``` The **recommended** approach: ```javascript export default class TodoApp extends React.Component { // ... } ``` also ```javascript const TodoApp = () => { //... }; export default TodoApp; ``` **[⬆ Back to Top](#table-of-contents)** 80. ### What is the recommended ordering of methods in component class? _Recommended_ ordering of methods from _mounting_ to _render stage_: 1. `static` methods 2. `constructor()` 3. `getChildContext()` 4. `componentWillMount()` 5. `componentDidMount()` 6. `componentWillReceiveProps()` 7. `shouldComponentUpdate()` 8. `componentWillUpdate()` 9. `componentDidUpdate()` 10. `componentWillUnmount()` 11. click handlers or event handlers like `onClickSubmit()` or `onChangeDescription()` 12. getter methods for render like `getSelectReason()` or `getFooterContent()` 13. optional render methods like `renderNavigation()` or `renderProfilePicture()` 14. `render()` **[⬆ Back to Top](#table-of-contents)** 81. ### What is a switching component? A _switching component_ is a component that renders one of many components. We need to use object to map prop values to components. For example, a switching component to display different pages based on `page` prop: ```jsx harmony import HomePage from "./HomePage"; import AboutPage from "./AboutPage"; import ServicesPage from "./ServicesPage"; import ContactPage from "./ContactPage"; const PAGES = { home: HomePage, about: AboutPage, services: ServicesPage, contact: ContactPage, }; const Page = (props) => { const Handler = PAGES[props.page] || ContactPage; return <Handler {...props} />; }; // The keys of the PAGES object can be used in the prop types to catch dev-time errors. Page.propTypes = { page: PropTypes.oneOf(Object.keys(PAGES)).isRequired, }; ``` **[⬆ Back to Top](#table-of-contents)** 82. ### Why we need to pass a function to setState()? The reason behind for this is that `setState()` is an asynchronous operation. React batches state changes for performance reasons, so the state may not change immediately after `setState()` is called. That means you should not rely on the current state when calling `setState()` since you can't be sure what that state will be. The solution is to pass a function to `setState()`, with the previous state as an argument. By doing this you can avoid issues with the user getting the old state value on access due to the asynchronous nature of `setState()`. Let's say the initial count value is zero. After three consecutive increment operations, the value is going to be incremented only by one. ```javascript // assuming this.state.count === 0 this.setState({ count: this.state.count + 1 }); this.setState({ count: this.state.count + 1 }); this.setState({ count: this.state.count + 1 }); // this.state.count === 1, not 3 ``` If we pass a function to `setState()`, the count gets incremented correctly. ```javascript this.setState((prevState, props) => ({ count: prevState.count + props.increment, })); // this.state.count === 3 as expected ``` **(OR)** ### Why function is preferred over object for `setState()`? React may batch multiple `setState()` calls into a single update for performance. Because `this.props` and `this.state` may be updated asynchronously, you should not rely on their values for calculating the next state. This counter example will fail to update as expected: ```javascript // Wrong this.setState({ counter: this.state.counter + this.props.increment, }); ``` The preferred approach is to call `setState()` with function rather than object. That function will receive the previous state as the first argument, and the props at the time the update is applied as the second argument. ```javascript // Correct this.setState((prevState, props) => ({ counter: prevState.counter + props.increment, })); ``` **[⬆ Back to Top](#table-of-contents)** 83. ### What is strict mode in React? `React.StrictMode` is a useful component for highlighting potential problems in an application. Just like `<Fragment>`, `<StrictMode>` does not render any extra DOM elements. It activates additional checks and warnings for its descendants. These checks apply for _development mode_ only. ```jsx harmony import React from "react"; function ExampleApplication() { return ( <div> <Header /> <React.StrictMode> <div> <ComponentOne /> <ComponentTwo /> </div> </React.StrictMode> <Header /> </div> ); } ``` In the example above, the _strict mode_ checks apply to `<ComponentOne>` and `<ComponentTwo>` components only. React.StrictMode currently helps you with: 1. Identifying components with unsafe lifecycles 2. Warning about legacy string ref API usage 3. Warning about deprecated `findDOMNode` usage 4. Detecting unexpected side effects 5. Detecting legacy context API **[⬆ Back to Top](#table-of-contents)** 84. ### What are React Mixins? _Mixins_ are a way to totally separate components to have a common functionality. Mixins **should not be used** and can be replaced with _higher-order components_ or _decorators_. One of the most commonly used mixins is `PureRenderMixin`. You might be using it in some components to prevent unnecessary re-renders when the props and state are shallowly equal to the previous props and state: ```javascript const PureRenderMixin = require("react-addons-pure-render-mixin"); const Button = React.createClass({ mixins: [PureRenderMixin], // ... }); ``` <!-- TODO: mixins are deprecated --> **[⬆ Back to Top](#table-of-contents)** 85. ### Why is `isMounted()` an anti-pattern and what is the proper solution? The primary use case for `isMounted()` is to avoid calling `setState()` after a component has been unmounted, because it will emit a warning. ```javascript if (this.isMounted()) { this.setState({...}) } ``` Checking `isMounted()` before calling `setState()` does eliminate the warning, but it also defeats the purpose of the warning. Using `isMounted()` is a code smell because the only reason you would check is because you think you might be holding a reference after the component has unmounted. An optimal solution would be to find places where `setState()` might be called after a component has unmounted, and fix them. Such situations most commonly occur due to callbacks, when a component is waiting for some data and gets unmounted before the data arrives. Ideally, any callbacks should be canceled in `componentWillUnmount()`, prior to unmounting. **[⬆ Back to Top](#table-of-contents)** 86. ### What are the Pointer Events supported in React? _Pointer Events_ provide a unified way of handling all input events. In the old days we had a mouse and respective event listeners to handle them but nowadays we have many devices which don't correlate to having a mouse, like phones with touch surface or pens. We need to remember that these events will only work in browsers that support the _Pointer Events_ specification. The following event types are now available in _React DOM_: 1. `onPointerDown` 2. `onPointerMove` 3. `onPointerUp` 4. `onPointerCancel` 5. `onGotPointerCapture` 6. `onLostPointerCapture` 7. `onPointerEnter` 8. `onPointerLeave` 9. `onPointerOver` 10. `onPointerOut` **[⬆ Back to Top](#table-of-contents)** 87. ### Why should component names start with capital letter? If you are rendering your component using JSX, the name of that component has to begin with a capital letter otherwise React will throw an error as an unrecognized tag. This convention is because only HTML elements and SVG tags can begin with a lowercase letter. ```jsx harmony class SomeComponent extends Component { // Code goes here } ``` You can define component class which name starts with lowercase letter, but when it's imported it should have capital letter. Here lowercase is fine: ```jsx harmony class myComponent extends Component { render() { return <div />; } } export default myComponent; ``` While when imported in another file it should start with capital letter: ```jsx harmony import MyComponent from "./myComponent"; ``` #### What are the exceptions on React component naming? The component names should start with an uppercase letter but there are few exceptions to this convention. The lowercase tag names with a dot (property accessors) are still considered as valid component names. For example, the below tag can be compiled to a valid component, ```jsx harmony render() { return ( <obj.component/> // `React.createElement(obj.component)` ) } ``` **[⬆ Back to Top](#table-of-contents)** 88. ### Are custom DOM attributes supported in React v16? Yes. In the past, React used to ignore unknown DOM attributes. If you wrote JSX with an attribute that React doesn't recognize, React would just skip it. For example, let's take a look at the below attribute: ```jsx harmony <div mycustomattribute={"something"} /> ``` Would render an empty div to the DOM with React v15: ```html <div /> ``` In React v16 any unknown attributes will end up in the DOM: ```html <div mycustomattribute="something" /> ``` This is useful for supplying browser-specific non-standard attributes, trying new DOM APIs, and integrating with opinionated third-party libraries. **[⬆ Back to Top](#table-of-contents)** 89. ### What is the difference between constructor and getInitialState? You should initialize state in the constructor when using ES6 classes, and `getInitialState()` method when using `React.createClass()`. **Using ES6 classes:** ```javascript class MyComponent extends React.Component { constructor(props) { super(props); this.state = { /* initial state */ }; } } ``` **Using `React.createClass()`:** ```javascript const MyComponent = React.createClass({ getInitialState() { return { /* initial state */ }; }, }); ``` **Note:** `React.createClass()` is deprecated and removed in React v16. Use plain JavaScript classes instead. **[⬆ Back to Top](#table-of-contents)** 90. ### Can you force a component to re-render without calling setState? By default, when your component's state or props change, your component will re-render. If your `render()` method depends on some other data, you can tell React that the component needs re-rendering by calling `forceUpdate()`. ```javascript component.forceUpdate(callback); ``` It is recommended to avoid all uses of `forceUpdate()` and only read from `this.props` and `this.state` in `render()`. **[⬆ Back to Top](#table-of-contents)** 91. ### What is the difference between `super()` and `super(props)` in React using ES6 classes? When you want to access `this.props` in `constructor()` then you should pass props to `super()` method. **Using `super(props)`:** ```javascript class MyComponent extends React.Component { constructor(props) { super(props); console.log(this.props); // { name: 'John', ... } } } ``` **Using `super()`:** ```javascript class MyComponent extends React.Component { constructor(props) { super(); console.log(this.props); // undefined } } ``` Outside `constructor()` both will display same value for `this.props`. **[⬆ Back to Top](#table-of-contents)** 92. ### How to loop inside JSX? You can simply use `Array.prototype.map` with ES6 _arrow function_ syntax. For example, the `items` array of objects is mapped into an array of components: ```jsx harmony <tbody> {items.map((item) => ( <SomeComponent key={item.id} name={item.name} /> ))} </tbody> ``` But you can't iterate using `for` loop: ```jsx harmony <tbody> for (let i = 0; i < items.length; i++) { <SomeComponent key={items[i].id} name={items[i].name} /> } </tbody> ``` This is because JSX tags are transpiled into _function calls_, and you can't use statements inside expressions. This may change thanks to `do` expressions which are _stage 1 proposal_. **[⬆ Back to Top](#table-of-contents)** 93. ### How do you access props in attribute quotes? React (or JSX) doesn't support variable interpolation inside an attribute value. The below representation won't work: ```jsx harmony <img className="image" src="images/{this.props.image}" /> ``` But you can put any JS expression inside curly braces as the entire attribute value. So the below expression works: ```jsx harmony <img className="image" src={"images/" + this.props.image} /> ``` Using _template strings_ will also work: ```jsx harmony <img className="image" src={`images/${this.props.image}`} /> ``` **[⬆ Back to Top](#table-of-contents)** 94. ### What is React proptype array with shape? If you want to pass an array of objects to a component with a particular shape then use `React.PropTypes.shape()` as an argument to `React.PropTypes.arrayOf()`. ```javascript ReactComponent.propTypes = { arrayWithShape: React.PropTypes.arrayOf( React.PropTypes.shape({ color: React.PropTypes.string.isRequired, fontSize: React.PropTypes.number.isRequired, }) ).isRequired, }; ``` **[⬆ Back to Top](#table-of-contents)** 95. ### How to conditionally apply class attributes? You shouldn't use curly braces inside quotes because it is going to be evaluated as a string. ```jsx harmony <div className="btn-panel {this.props.visible ? 'show' : 'hidden'}"> ``` Instead you need to move curly braces outside (don't forget to include spaces between class names): ```jsx harmony <div className={'btn-panel ' + (this.props.visible ? 'show' : 'hidden')}> ``` _Template strings_ will also work: ```jsx harmony <div className={`btn-panel ${this.props.visible ? 'show' : 'hidden'}`}> ``` **[⬆ Back to Top](#table-of-contents)** 96. ### What is the difference between React and ReactDOM? The `react` package contains `React.createElement()`, `React.Component`, `React.Children`, and other helpers related to elements and component classes. You can think of these as the isomorphic or universal helpers that you need to build components. The `react-dom` package contains `ReactDOM.render()`, and in `react-dom/server` we have _server-side rendering_ support with `ReactDOMServer.renderToString()` and `ReactDOMServer.renderToStaticMarkup()`. **[⬆ Back to Top](#table-of-contents)** 97. ### Why ReactDOM is separated from React? The React team worked on extracting all DOM-related features into a separate library called _ReactDOM_. React v0.14 is the first release in which the libraries are split. By looking at some of the packages, `react-native`, `react-art`, `react-canvas`, and `react-three`, it has become clear that the beauty and essence of React has nothing to do with browsers or the DOM. To build more environments that React can render to, React team planned to split the main React package into two: `react` and `react-dom`. This paves the way to writing components that can be shared between the web version of React and React Native. **[⬆ Back to Top](#table-of-contents)** 98. ### How to use React label element? If you try to render a `<label>` element bound to a text input using the standard `for` attribute, then it produces HTML missing that attribute and prints a warning to the console. ```jsx harmony <label for={'user'}>{'User'}</label> <input type={'text'} id={'user'} /> ``` Since `for` is a reserved keyword in JavaScript, use `htmlFor` instead. ```jsx harmony <label htmlFor={'user'}>{'User'}</label> <input type={'text'} id={'user'} /> ``` **[⬆ Back to Top](#table-of-contents)** 99. ### How to combine multiple inline style objects? You can use _spread operator_ in regular React: ```jsx harmony <button style={{ ...styles.panel.button, ...styles.panel.submitButton }}> {"Submit"} </button> ``` If you're using React Native then you can use the array notation: ```jsx harmony <button style={[styles.panel.button, styles.panel.submitButton]}> {"Submit"} </button> ``` **[⬆ Back to Top](#table-of-contents)** 100. ### How to re-render the view when the browser is resized? You can use the `useState` hook to manage the width and height state variables, and the `useEffect` hook to add and remove the `resize` event listener. The `[]` dependency array passed to useEffect ensures that the effect only runs once (on mount) and not on every re-render. ```javascript import React, { useState, useEffect } from "react"; function WindowDimensions() { const [dimensions, setDimensions] = useState({ width: window.innerWidth, height: window.innerHeight, }); useEffect(() => { function handleResize() { setDimensions({ width: window.innerWidth, height: window.innerHeight, }); } window.addEventListener("resize", handleResize); return () => window.removeEventListener("resize", handleResize); }, []); return ( <span> {dimensions.width} x {dimensions.height} </span> ); } ``` <details> <summary><h4>Using Class Component</h4></summary> You can listen to the `resize` event in `componentDidMount()` and then update the dimensions (`width` and `height`). You should remove the listener in `componentWillUnmount()` method. ```javascript class WindowDimensions extends React.Component { constructor(props) { super(props); this.updateDimensions = this.updateDimensions.bind(this); } componentWillMount() { this.updateDimensions(); } componentDidMount() { window.addEventListener("resize", this.updateDimensions); } componentWillUnmount() { window.removeEventListener("resize", this.updateDimensions); } updateDimensions() { this.setState({ width: window.innerWidth, height: window.innerHeight, }); } render() { return ( <span> {this.state.width} x {this.state.height} </span> ); } } ``` </details> **[⬆ Back to Top](#table-of-contents)** 101. ### What is the difference between `setState()` and `replaceState()` methods? When you use `setState()` the current and previous states are merged. `replaceState()` throws out the current state, and replaces it with only what you provide. Usually `setState()` is used unless you really need to remove all previous keys for some reason. You can also set state to `false`/`null` in `setState()` instead of using `replaceState()`. **[⬆ Back to Top](#table-of-contents)** 102. ### How to listen to state changes? The `componentDidUpdate` lifecycle method will be called when state changes. You can compare provided state and props values with current state and props to determine if something meaningful changed. ``` componentDidUpdate(object prevProps, object prevState) ``` **Note:** The previous releases of ReactJS also uses `componentWillUpdate(object nextProps, object nextState)` for state changes. It has been deprecated in latest releases. **[⬆ Back to Top](#table-of-contents)** 103. ### What is the recommended approach of removing an array element in React state? The better approach is to use `Array.prototype.filter()` method. For example, let's create a `removeItem()` method for updating the state. ```javascript removeItem(index) { this.setState({ data: this.state.data.filter((item, i) => i !== index) }) } ``` **[⬆ Back to Top](#table-of-contents)** 104. ### Is it possible to use React without rendering HTML? It is possible. Below are the possible options: ```jsx harmony render() { return false } ``` ```jsx harmony render() { return true } ``` ```jsx harmony render() { return null } ``` React version >=16.0.0: ```jsx harmony render() { return [] } ``` ```jsx harmony render() { return "" } ``` React version >=16.2.0: ```jsx harmony render() { return <React.Fragment></React.Fragment> } ``` ```jsx harmony render() { return <></> } ``` React version >=18.0.0: ```jsx harmony render() { return undefined } ``` **[⬆ Back to Top](#table-of-contents)** 105. ### How to pretty print JSON with React? We can use `<pre>` tag so that the formatting of the `JSON.stringify()` is retained: ```jsx harmony const data = { name: "John", age: 42 }; class User extends React.Component { render() { return <pre>{JSON.stringify(data, null, 2)}</pre>; } } React.render(<User />, document.getElementById("container")); ``` **[⬆ Back to Top](#table-of-contents)** 106. ### Why you can't update props in React? The React philosophy is that props should be _immutable_ and _top-down_. This means that a parent can send any prop values to a child, but the child can't modify received props. **[⬆ Back to Top](#table-of-contents)** 107. ### How to focus an input element on page load? You can do it by creating _ref_ for `input` element and using it in `componentDidMount()`: ```jsx harmony class App extends React.Component { componentDidMount() { this.nameInput.focus(); } render() { return ( <div> <input defaultValue={"Won't focus"} /> <input ref={(input) => (this.nameInput = input)} defaultValue={"Will focus"} /> </div> ); } } ReactDOM.render(<App />, document.getElementById("app")); ``` Also in Functional component (react 16.08 and above) ```jsx harmony import React, { useEffect, useRef } from "react"; const App = () => { const inputElRef = useRef(null); useEffect(() => { inputElRef.current.focus(); }, []); return ( <div> <input defaultValue={"Won't focus"} /> <input ref={inputElRef} defaultValue={"Will focus"} /> </div> ); }; ReactDOM.render(<App />, document.getElementById("app")); ``` **[⬆ Back to Top](#table-of-contents)** 108. ### What are the possible ways of updating objects in state? 1. **Calling `setState()` with an object to merge with state:** - Using `Object.assign()` to create a copy of the object: ```javascript const user = Object.assign({}, this.state.user, { age: 42 }); this.setState({ user }); ``` - Using _spread operator_: ```javascript const user = { ...this.state.user, age: 42 }; this.setState({ user }); ``` 2. **Calling `setState()` with a function:** ```javascript this.setState((prevState) => ({ user: { ...prevState.user, age: 42, }, })); ``` **[⬆ Back to Top](#table-of-contents)** 110. ### How can we find the version of React at runtime in the browser? You can use `React.version` to get the version. ```jsx harmony const REACT_VERSION = React.version; ReactDOM.render( <div>{`React version: ${REACT_VERSION}`}</div>, document.getElementById("app") ); ``` **[⬆ Back to Top](#table-of-contents)** 111. ### What are the approaches to include polyfills in your `create-react-app`? There are approaches to include polyfills in create-react-app, 1. **Manual import from `core-js`:** Create a file called (something like) `polyfills.js` and import it into root `index.js` file. Run `npm install core-js` or `yarn add core-js` and import your specific required features. ```javascript import "core-js/fn/array/find"; import "core-js/fn/array/includes"; import "core-js/fn/number/is-nan"; ``` 2. **Using Polyfill service:** Use the polyfill.io CDN to retrieve custom, browser-specific polyfills by adding this line to `index.html`: ```html <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=default,Array.prototype.includes"></script> ``` In the above script we had to explicitly request the `Array.prototype.includes` feature as it is not included in the default feature set. **[⬆ Back to Top](#table-of-contents)** 112. ### How to use https instead of http in create-react-app? You just need to use `HTTPS=true` configuration. You can edit your `package.json` scripts section: ```json "scripts": { "start": "set HTTPS=true && react-scripts start" } ``` or just run `set HTTPS=true && npm start` **[⬆ Back to Top](#table-of-contents)** 113. ### How to avoid using relative path imports in create-react-app? Create a file called `.env` in the project root and write the import path: ``` NODE_PATH=src/app ``` After that restart the development server. Now you should be able to import anything inside `src/app` without relative paths. **[⬆ Back to Top](#table-of-contents)** 114. ### How to add Google Analytics for React Router? Add a listener on the `history` object to record each page view: ```javascript history.listen(function (location) { window.ga("set", "page", location.pathname + location.search); window.ga("send", "pageview", location.pathname + location.search); }); ``` **[⬆ Back to Top](#table-of-contents)** 115. ### How to update a component every second? You need to use `setInterval()` to trigger the change, but you also need to clear the timer when the component unmounts to prevent errors and memory leaks. ```javascript componentDidMount() { this.interval = setInterval(() => this.setState({ time: Date.now() }), 1000) } componentWillUnmount() { clearInterval(this.interval) } ``` **[⬆ Back to Top](#table-of-contents)** 116. ### How do you apply vendor prefixes to inline styles in React? React _does not_ apply _vendor prefixes_ automatically. You need to add vendor prefixes manually. ```jsx harmony <div style={{ transform: "rotate(90deg)", WebkitTransform: "rotate(90deg)", // note the capital 'W' here msTransform: "rotate(90deg)", // 'ms' is the only lowercase vendor prefix }} /> ``` **[⬆ Back to Top](#table-of-contents)** 117. ### How to import and export components using React and ES6? You should use default for exporting the components ```jsx harmony import React from "react"; import User from "user"; export default class MyProfile extends React.Component { render() { return <User type="customer">//...</User>; } } ``` With the export specifier, the MyProfile is going to be the member and exported to this module and the same can be imported without mentioning the name in other components. **[⬆ Back to Top](#table-of-contents)** 119. ### Why is a component constructor called only once? React's _reconciliation_ algorithm assumes that without any information to the contrary, if a custom component appears in the same place on subsequent renders, it's the same component as before, so reuses the previous instance rather than creating a new one. **[⬆ Back to Top](#table-of-contents)** 120. ### How to define constants in React? You can use ES7 `static` field to define constant. ```javascript class MyComponent extends React.Component { static DEFAULT_PAGINATION = 10; } ``` **[⬆ Back to Top](#table-of-contents)** 121. ### How to programmatically trigger click event in React? You could use the ref prop to acquire a reference to the underlying `HTMLInputElement` object through a callback, store the reference as a class property, then use that reference to later trigger a click from your event handlers using the `HTMLElement.click` method. This can be done in two steps: 1. Create ref in render method: ```jsx harmony <input ref={(input) => (this.inputElement = input)} /> ``` 2. Apply click event in your event handler: ```javascript this.inputElement.click(); ``` **[⬆ Back to Top](#table-of-contents)** 122. ### Is it possible to use async/await in plain React? If you want to use `async`/`await` in React, you will need _Babel_ and [transform-async-to-generator](https://babeljs.io/docs/en/babel-plugin-transform-async-to-generator) plugin. React Native ships with Babel and a set of transforms. **[⬆ Back to Top](#table-of-contents)** 123. ### What are the common folder structures for React? There are two common practices for React project file structure. 1. **Grouping by features or routes:** One common way to structure projects is locate CSS, JS, and tests together, grouped by feature or route. ``` common/ ├─ Avatar.js ├─ Avatar.css ├─ APIUtils.js └─ APIUtils.test.js feed/ ├─ index.js ├─ Feed.js ├─ Feed.css ├─ FeedStory.js ├─ FeedStory.test.js └─ FeedAPI.js profile/ ├─ index.js ├─ Profile.js ├─ ProfileHeader.js ├─ ProfileHeader.css └─ ProfileAPI.js ``` 2. **Grouping by file type:** Another popular way to structure projects is to group similar files together. ``` api/ ├─ APIUtils.js ├─ APIUtils.test.js ├─ ProfileAPI.js └─ UserAPI.js components/ ├─ Avatar.js ├─ Avatar.css ├─ Feed.js ├─ Feed.css ├─ FeedStory.js ├─ FeedStory.test.js ├─ Profile.js ├─ ProfileHeader.js └─ ProfileHeader.css ``` **[⬆ Back to Top](#table-of-contents)** 124. ### What are the popular packages for animation? _React Transition Group_ and _React Motion_ are popular animation packages in React ecosystem. **[⬆ Back to Top](#table-of-contents)** 125. ### What is the benefit of styles modules? It is recommended to avoid hard coding style values in components. Any values that are likely to be used across different UI components should be extracted into their own modules. For example, these styles could be extracted into a separate component: ```javascript export const colors = { white, black, blue, }; export const space = [0, 8, 16, 32, 64]; ``` And then imported individually in other components: ```javascript import { space, colors } from "./styles"; ``` **[⬆ Back to Top](#table-of-contents)** 126. ### What are the popular React-specific linters? ESLint is a popular JavaScript linter. There are plugins available that analyse specific code styles. One of the most common for React is an npm package called `eslint-plugin-react`. By default, it will check a number of best practices, with rules checking things from keys in iterators to a complete set of prop types. Another popular plugin is `eslint-plugin-jsx-a11y`, which will help fix common issues with accessibility. As JSX offers slightly different syntax to regular HTML, issues with `alt` text and `tabindex`, for example, will not be picked up by regular plugins. **[⬆ Back to Top](#table-of-contents)** 127. ### How to make AJAX call and in which component lifecycle methods should I make an AJAX call? You can use AJAX libraries such as Axios, jQuery AJAX, and the browser built-in `fetch`. You should fetch data in the `componentDidMount()` lifecycle method. This is so you can use `setState()` to update your component when the data is retrieved. For example, the employees list fetched from API and set local state: ```jsx harmony class MyComponent extends React.Component { constructor(props) { super(props); this.state = { employees: [], error: null, }; } componentDidMount() { fetch("https://api.example.com/items") .then((res) => res.json()) .then( (result) => { this.setState({ employees: result.employees, }); }, (error) => { this.setState({ error }); } ); } render() { const { error, employees } = this.state; if (error) { return <div>Error: {error.message}</div>; } else { return ( <ul> {employees.map((employee) => ( <li key={employee.name}> {employee.name}-{employee.experience} </li> ))} </ul> ); } } } ``` **[⬆ Back to Top](#table-of-contents)** 128. ### What are render props? **Render Props** is a simple technique for sharing code between components using a prop whose value is a function. The below component uses render prop which returns a React element. ```jsx harmony <DataProvider render={(data) => <h1>{`Hello ${data.target}`}</h1>} /> ``` Libraries such as React Router and DownShift are using this pattern. ## React Router **[⬆ Back to Top](#table-of-contents)** 129. ### What is React Router? React Router is a powerful routing library built on top of React that helps you add new screens and flows to your application incredibly quickly, all while keeping the URL in sync with what's being displayed on the page. **[⬆ Back to Top](#table-of-contents)** 130. ### How React Router is different from history library? React Router is a wrapper around the `history` library which handles interaction with the browser's `window.history` with its browser and hash histories. It also provides memory history which is useful for environments that don't have global history, such as mobile app development (React Native) and unit testing with Node. **[⬆ Back to Top](#table-of-contents)** 131. ### What are the `<Router>` components of React Router v4? React Router v4 provides below 3 `<Router>` components: 1. `<BrowserRouter>` 2. `<HashRouter>` 3. `<MemoryRouter>` The above components will create _browser_, _hash_, and _memory_ history instances. React Router v4 makes the properties and methods of the `history` instance associated with your router available through the context in the `router` object. **[⬆ Back to Top](#table-of-contents)** 132. ### What is the purpose of `push()` and `replace()` methods of `history`? A history instance has two methods for navigation purpose. 1. `push()` 2. `replace()` If you think of the history as an array of visited locations, `push()` will add a new location to the array and `replace()` will replace the current location in the array with the new one. **[⬆ Back to Top](#table-of-contents)** 133. ### How do you programmatically navigate using React Router v4? There are three different ways to achieve programmatic routing/navigation within components. 1. **Using the `withRouter()` higher-order function:** The `withRouter()` higher-order function will inject the history object as a prop of the component. This object provides `push()` and `replace()` methods to avoid the usage of context. ```jsx harmony import { withRouter } from "react-router-dom"; // this also works with 'react-router-native' const Button = withRouter(({ history }) => ( <button type="button" onClick={() => { history.push("/new-location"); }} > {"Click Me!"} </button> )); ``` 2. **Using `<Route>` component and render props pattern:** The `<Route>` component passes the same props as `withRouter()`, so you will be able to access the history methods through the history prop. ```jsx harmony import { Route } from "react-router-dom"; const Button = () => ( <Route render={({ history }) => ( <button type="button" onClick={() => { history.push("/new-location"); }} > {"Click Me!"} </button> )} /> ); ``` 3. **Using context:** This option is not recommended and treated as unstable API. ```jsx harmony const Button = (props, context) => ( <button type="button" onClick={() => { context.history.push("/new-location"); }} > {"Click Me!"} </button> ); Button.contextTypes = { history: React.PropTypes.shape({ push: React.PropTypes.func.isRequired, }), }; ``` **[⬆ Back to Top](#table-of-contents)** 134. ### How to get query parameters in React Router v4? The ability to parse query strings was taken out of React Router v4 because there have been user requests over the years to support different implementation. So the decision has been given to users to choose the implementation they like. The recommended approach is to use query strings library. ```javascript const queryString = require("query-string"); const parsed = queryString.parse(props.location.search); ``` You can also use `URLSearchParams` if you want something native: ```javascript const params = new URLSearchParams(props.location.search); const foo = params.get("name"); ``` You should use a _polyfill_ for IE11. **[⬆ Back to Top](#table-of-contents)** 135. ### Why you get "Router may have only one child element" warning? You have to wrap your Route's in a `<Switch>` block because `<Switch>` is unique in that it renders a route exclusively. At first you need to add `Switch` to your imports: ```javascript import { Switch, Router, Route } from "react-router"; ``` Then define the routes within `<Switch>` block: ```jsx harmony <Router> <Switch> <Route {/* ... */} /> <Route {/* ... */} /> </Switch> </Router> ``` **[⬆ Back to Top](#table-of-contents)** 136. ### How to pass params to `history.push` method in React Router v4? While navigating you can pass props to the `history` object: ```javascript this.props.history.push({ pathname: "/template", search: "?name=sudheer", state: { detail: response.data }, }); ``` The `search` property is used to pass query params in `push()` method. **[⬆ Back to Top](#table-of-contents)** 137. ### How to implement _default_ or _NotFound_ page? A `<Switch>` renders the first child `<Route>` that matches. A `<Route>` with no path always matches. So you just need to simply drop path attribute as below ```jsx harmony <Switch> <Route exact path="/" component={Home} /> <Route path="/user" component={User} /> <Route component={NotFound} /> </Switch> ``` **[⬆ Back to Top](#table-of-contents)** 138. ### How to get history on React Router v4? Below are the list of steps to get history object on React Router v4, 1. Create a module that exports a `history` object and import this module across the project. For example, create `history.js` file: ```javascript import { createBrowserHistory } from "history"; export default createBrowserHistory({ /* pass a configuration object here if needed */ }); ``` 2. You should use the `<Router>` component instead of built-in routers. Import the above `history.js` inside `index.js` file: ```jsx harmony import { Router } from "react-router-dom"; import history from "./history"; import App from "./App"; ReactDOM.render( <Router history={history}> <App /> </Router>, holder ); ``` 3. You can also use push method of `history` object similar to built-in history object: ```javascript // some-other-file.js import history from "./history"; history.push("/go-here"); ``` **[⬆ Back to Top](#table-of-contents)** 139. ### How to perform automatic redirect after login? The `react-router` package provides `<Redirect>` component in React Router. Rendering a `<Redirect>` will navigate to a new location. Like server-side redirects, the new location will override the current location in the history stack. ```javascript import React, { Component } from "react"; import { Redirect } from "react-router"; export default class LoginComponent extends Component { render() { if (this.state.isLoggedIn === true) { return <Redirect to="/your/redirect/page" />; } else { return <div>{"Login Please"}</div>; } } } ``` ## React Internationalization **[⬆ Back to Top](#table-of-contents)** 140. ### What is React Intl? The _React Intl_ library makes internationalization in React straightforward, with off-the-shelf components and an API that can handle everything from formatting strings, dates, and numbers, to pluralization. React Intl is part of _FormatJS_ which provides bindings to React via its components and API. **[⬆ Back to Top](#table-of-contents)** 141. ### What are the main features of React Intl? Below are the main features of React Intl, 1. Display numbers with separators. 2. Display dates and times correctly. 3. Display dates relative to "now". 4. Pluralize labels in strings. 5. Support for 150+ languages. 6. Runs in the browser and Node. 7. Built on standards. **[⬆ Back to Top](#table-of-contents)** 142. ### What are the two ways of formatting in React Intl? The library provides two ways to format strings, numbers, and dates: 1. **Using react components:** ```jsx harmony <FormattedMessage id={"account"} defaultMessage={"The amount is less than minimum balance."} /> ``` 2. **Using an API:** ```javascript const messages = defineMessages({ accountMessage: { id: "account", defaultMessage: "The amount is less than minimum balance.", }, }); formatMessage(messages.accountMessage); ``` **[⬆ Back to Top](#table-of-contents)** 143. ### How to use `<FormattedMessage>` as placeholder using React Intl? The `<Formatted... />` components from `react-intl` return elements, not plain text, so they can't be used for placeholders, alt text, etc. In that case, you should use lower level API `formatMessage()`. You can inject the `intl` object into your component using `injectIntl()` higher-order component and then format the message using `formatMessage()` available on that object. ```jsx harmony import React from "react"; import { injectIntl, intlShape } from "react-intl"; const MyComponent = ({ intl }) => { const placeholder = intl.formatMessage({ id: "messageId" }); return <input placeholder={placeholder} />; }; MyComponent.propTypes = { intl: intlShape.isRequired, }; export default injectIntl(MyComponent); ``` **[⬆ Back to Top](#table-of-contents)** 144. ### How to access current locale with React Intl? You can get the current locale in any component of your application using `injectIntl()`: ```jsx harmony import { injectIntl, intlShape } from "react-intl"; const MyComponent = ({ intl }) => ( <div>{`The current locale is ${intl.locale}`}</div> ); MyComponent.propTypes = { intl: intlShape.isRequired, }; export default injectIntl(MyComponent); ``` **[⬆ Back to Top](#table-of-contents)** 145. ### How to format date using React Intl? The `injectIntl()` higher-order component will give you access to the `formatDate()` method via the props in your component. The method is used internally by instances of `FormattedDate` and it returns the string representation of the formatted date. ```jsx harmony import { injectIntl, intlShape } from "react-intl"; const stringDate = this.props.intl.formatDate(date, { year: "numeric", month: "numeric", day: "numeric", }); const MyComponent = ({ intl }) => ( <div>{`The formatted date is ${stringDate}`}</div> ); MyComponent.propTypes = { intl: intlShape.isRequired, }; export default injectIntl(MyComponent); ``` ## React Testing **[⬆ Back to Top](#table-of-contents)** 146. ### What is Shallow Renderer in React testing? _Shallow rendering_ is useful for writing unit test cases in React. It lets you render a component _one level deep_ and assert facts about what its render method returns, without worrying about the behavior of child components, which are not instantiated or rendered. For example, if you have the following component: ```javascript function MyComponent() { return ( <div> <span className={"heading"}>{"Title"}</span> <span className={"description"}>{"Description"}</span> </div> ); } ``` Then you can assert as follows: ```jsx harmony import ShallowRenderer from "react-test-renderer/shallow"; // in your test const renderer = new ShallowRenderer(); renderer.render(<MyComponent />); const result = renderer.getRenderOutput(); expect(result.type).toBe("div"); expect(result.props.children).toEqual([ <span className={"heading"}>{"Title"}</span>, <span className={"description"}>{"Description"}</span>, ]); ``` **[⬆ Back to Top](#table-of-contents)** 147. ### What is `TestRenderer` package in React? This package provides a renderer that can be used to render components to pure JavaScript objects, without depending on the DOM or a native mobile environment. This package makes it easy to grab a snapshot of the platform view hierarchy (similar to a DOM tree) rendered by a ReactDOM or React Native without using a browser or `jsdom`. ```jsx harmony import TestRenderer from "react-test-renderer"; const Link = ({ page, children }) => <a href={page}>{children}</a>; const testRenderer = TestRenderer.create( <Link page={"https://www.facebook.com/"}>{"Facebook"}</Link> ); console.log(testRenderer.toJSON()); // { // type: 'a', // props: { href: 'https://www.facebook.com/' }, // children: [ 'Facebook' ] // } ``` **[⬆ Back to Top](#table-of-contents)** 148. ### What is the purpose of ReactTestUtils package? _ReactTestUtils_ are provided in the `with-addons` package and allow you to perform actions against a simulated DOM for the purpose of unit testing. **[⬆ Back to Top](#table-of-contents)** 149. ### What is Jest? _Jest_ is a JavaScript unit testing framework created by Facebook based on Jasmine and provides automated mock creation and a `jsdom` environment. It's often used for testing components. **[⬆ Back to Top](#table-of-contents)** 150. ### What are the advantages of Jest over Jasmine? There are couple of advantages compared to Jasmine: - Automatically finds tests to execute in your source code. - Automatically mocks dependencies when running your tests. - Allows you to test asynchronous code synchronously. - Runs your tests with a fake DOM implementation (via `jsdom`) so that your tests can be run on the command line. - Runs tests in parallel processes so that they finish sooner. **[⬆ Back to Top](#table-of-contents)** 151. ### Give a simple example of Jest test case Let's write a test for a function that adds two numbers in `sum.js` file: ```javascript const sum = (a, b) => a + b; export default sum; ``` Create a file named `sum.test.js` which contains actual test: ```javascript import sum from "./sum"; test("adds 1 + 2 to equal 3", () => { expect(sum(1, 2)).toBe(3); }); ``` And then add the following section to your `package.json`: ```json { "scripts": { "test": "jest" } } ``` Finally, run `yarn test` or `npm test` and Jest will print a result: ```console $ yarn test PASS ./sum.test.js ✓ adds 1 + 2 to equal 3 (2ms) ``` ## React Redux **[⬆ Back to Top](#table-of-contents)** 152. ### What is flux? _Flux_ is an _application design paradigm_ used as a replacement for the more traditional MVC pattern. It is not a framework or a library but a new kind of architecture that complements React and the concept of Unidirectional Data Flow. Facebook uses this pattern internally when working with React. The workflow between dispatcher, stores and views components with distinct inputs and outputs as follows: ![flux](images/flux.png) **[⬆ Back to Top](#table-of-contents)** 153. ### What is Redux? _Redux_ is a predictable state container for JavaScript apps based on the _Flux design pattern_. Redux can be used together with React, or with any other view library. It is tiny (about 2kB) and has no dependencies. **[⬆ Back to Top](#table-of-contents)** 154. ### What are the core principles of Redux? Redux follows three fundamental principles: 1. **Single source of truth:** The state of your whole application is stored in an object tree within a single store. The single state tree makes it easier to keep track of changes over time and debug or inspect the application. 2. **State is read-only:** The only way to change the state is to emit an action, an object describing what happened. This ensures that neither the views nor the network callbacks will ever write directly to the state. 3. **Changes are made with pure functions:** To specify how the state tree is transformed by actions, you write reducers. Reducers are just pure functions that take the previous state and an action as parameters, and return the next state. **[⬆ Back to Top](#table-of-contents)** 155. ### What are the downsides of Redux compared to Flux? Instead of saying downsides we can say that there are few compromises of using Redux over Flux. Those are as follows: 1. **You will need to learn to avoid mutations:** Flux is un-opinionated about mutating data, but Redux doesn't like mutations and many packages complementary to Redux assume you never mutate the state. You can enforce this with dev-only packages like `redux-immutable-state-invariant`, Immutable.js, or instructing your team to write non-mutating code. 2. **You're going to have to carefully pick your packages:** While Flux explicitly doesn't try to solve problems such as undo/redo, persistence, or forms, Redux has extension points such as middleware and store enhancers, and it has spawned a rich ecosystem. 3. **There is no nice Flow integration yet:** Flux currently lets you do very impressive static type checks which Redux doesn't support yet. **[⬆ Back to Top](#table-of-contents)** 156. ### What is the difference between `mapStateToProps()` and `mapDispatchToProps()`? `mapStateToProps()` is a utility which helps your component get updated state (which is updated by some other components): ```javascript const mapStateToProps = (state) => { return { todos: getVisibleTodos(state.todos, state.visibilityFilter), }; }; ``` `mapDispatchToProps()` is a utility which will help your component to fire an action event (dispatching action which may cause change of application state): ```javascript const mapDispatchToProps = (dispatch) => { return { onTodoClick: (id) => { dispatch(toggleTodo(id)); }, }; }; ``` It is recommended to always use the “object shorthand” form for the `mapDispatchToProps`. Redux wraps it in another function that looks like (…args) => dispatch(onTodoClick(…args)), and pass that wrapper function as a prop to your component. ```javascript const mapDispatchToProps = { onTodoClick, }; ``` **[⬆ Back to Top](#table-of-contents)** 157. ### Can I dispatch an action in reducer? Dispatching an action within a reducer is an **anti-pattern**. Your reducer should be _without side effects_, simply digesting the action payload and returning a new state object. Adding listeners and dispatching actions within the reducer can lead to chained actions and other side effects. **[⬆ Back to Top](#table-of-contents)** 158. ### How to access Redux store outside a component? You just need to export the store from the module where it created with `createStore()`. Also, it shouldn't pollute the global window object. ```javascript store = createStore(myReducer); export default store; ``` **[⬆ Back to Top](#table-of-contents)** 159. ### What are the drawbacks of MVW pattern? 1. DOM manipulation is very expensive which causes applications to behave slow and inefficient. 2. Due to circular dependencies, a complicated model was created around models and views. 3. Lot of data changes happens for collaborative applications(like Google Docs). 4. No way to do undo (travel back in time) easily without adding so much extra code. **[⬆ Back to Top](#table-of-contents)** 160. ### Are there any similarities between Redux and RxJS? These libraries are very different for very different purposes, but there are some vague similarities. Redux is a tool for managing state throughout the application. It is usually used as an architecture for UIs. Think of it as an alternative to (half of) Angular. RxJS is a reactive programming library. It is usually used as a tool to accomplish asynchronous tasks in JavaScript. Think of it as an alternative to Promises. Redux uses the Reactive paradigm because the Store is reactive. The Store observes actions from a distance, and changes itself. RxJS also uses the Reactive paradigm, but instead of being an architecture, it gives you basic building blocks, Observables, to accomplish this pattern. **[⬆ Back to Top](#table-of-contents)** 161. ### How to dispatch an action on load? You can dispatch an action in `componentDidMount()` method and in `render()` method you can verify the data. ```javascript class App extends Component { componentDidMount() { this.props.fetchData(); } render() { return this.props.isLoaded ? ( <div>{"Loaded"}</div> ) : ( <div>{"Not Loaded"}</div> ); } } const mapStateToProps = (state) => ({ isLoaded: state.isLoaded, }); const mapDispatchToProps = { fetchData }; export default connect(mapStateToProps, mapDispatchToProps)(App); ``` **[⬆ Back to Top](#table-of-contents)** 162. ### How to use `connect()` from React Redux? You need to follow two steps to use your store in your container: 1. **Use `mapStateToProps()`:** It maps the state variables from your store to the props that you specify. 2. **Connect the above props to your container:** The object returned by the `mapStateToProps` function is connected to the container. You can import `connect()` from `react-redux`. ```jsx harmony import React from "react"; import { connect } from "react-redux"; class App extends React.Component { render() { return <div>{this.props.containerData}</div>; } } function mapStateToProps(state) { return { containerData: state.data }; } export default connect(mapStateToProps)(App); ``` **[⬆ Back to Top](#table-of-contents)** 163. ### How to reset state in Redux? You need to write a _root reducer_ in your application which delegate handling the action to the reducer generated by `combineReducers()`. For example, let us take `rootReducer()` to return the initial state after `USER_LOGOUT` action. As we know, reducers are supposed to return the initial state when they are called with `undefined` as the first argument, no matter the action. ```javascript const appReducer = combineReducers({ /* your app's top-level reducers */ }); const rootReducer = (state, action) => { if (action.type === "USER_LOGOUT") { state = undefined; } return appReducer(state, action); }; ``` In case of using `redux-persist`, you may also need to clean your storage. `redux-persist` keeps a copy of your state in a storage engine. First, you need to import the appropriate storage engine and then, to parse the state before setting it to undefined and clean each storage state key. ```javascript const appReducer = combineReducers({ /* your app's top-level reducers */ }); const rootReducer = (state, action) => { if (action.type === "USER_LOGOUT") { Object.keys(state).forEach((key) => { storage.removeItem(`persist:${key}`); }); state = undefined; } return appReducer(state, action); }; ``` **[⬆ Back to Top](#table-of-contents)** 164. ### Whats the purpose of `at` symbol in the Redux connect decorator? The **@** symbol is in fact a JavaScript expression used to signify decorators. _Decorators_ make it possible to annotate and modify classes and properties at design time. Let's take an example setting up Redux without and with a decorator. - **Without decorator:** ```javascript import React from "react"; import * as actionCreators from "./actionCreators"; import { bindActionCreators } from "redux"; import { connect } from "react-redux"; function mapStateToProps(state) { return { todos: state.todos }; } function mapDispatchToProps(dispatch) { return { actions: bindActionCreators(actionCreators, dispatch) }; } class MyApp extends React.Component { // ...define your main app here } export default connect(mapStateToProps, mapDispatchToProps)(MyApp); ``` - **With decorator:** ```javascript import React from "react"; import * as actionCreators from "./actionCreators"; import { bindActionCreators } from "redux"; import { connect } from "react-redux"; function mapStateToProps(state) { return { todos: state.todos }; } function mapDispatchToProps(dispatch) { return { actions: bindActionCreators(actionCreators, dispatch) }; } @connect(mapStateToProps, mapDispatchToProps) export default class MyApp extends React.Component { // ...define your main app here } ``` The above examples are almost similar except the usage of decorator. The decorator syntax isn't built into any JavaScript runtimes yet, and is still experimental and subject to change. You can use babel for the decorators support. **[⬆ Back to Top](#table-of-contents)** 165. ### What is the difference between React context and React Redux? You can use **Context** in your application directly and is going to be great for passing down data to deeply nested components which what it was designed for. Whereas **Redux** is much more powerful and provides a large number of features that the Context API doesn't provide. Also, React Redux uses context internally but it doesn't expose this fact in the public API. **[⬆ Back to Top](#table-of-contents)** 166. ### Why are Redux state functions called reducers? Reducers always return the accumulation of the state (based on all previous and current actions). Therefore, they act as a reducer of state. Each time a Redux reducer is called, the state and action are passed as parameters. This state is then reduced (or accumulated) based on the action, and then the next state is returned. You could _reduce_ a collection of actions and an initial state (of the store) on which to perform these actions to get the resulting final state. **[⬆ Back to Top](#table-of-contents)** 167. ### How to make AJAX request in Redux? You can use `redux-thunk` middleware which allows you to define async actions. Let's take an example of fetching specific account as an AJAX call using _fetch API_: ```javascript export function fetchAccount(id) { return (dispatch) => { dispatch(setLoadingAccountState()); // Show a loading spinner fetch(`/account/${id}`, (response) => { dispatch(doneFetchingAccount()); // Hide loading spinner if (response.status === 200) { dispatch(setAccount(response.json)); // Use a normal function to set the received state } else { dispatch(someError); } }); }; } function setAccount(data) { return { type: "SET_Account", data: data }; } ``` **[⬆ Back to Top](#table-of-contents)** 168. ### Should I keep all component's state in Redux store? Keep your data in the Redux store, and the UI related state internally in the component. **[⬆ Back to Top](#table-of-contents)** 169. ### What is the proper way to access Redux store? The best way to access your store in a component is to use the `connect()` function, that creates a new component that wraps around your existing one. This pattern is called _Higher-Order Components_, and is generally the preferred way of extending a component's functionality in React. This allows you to map state and action creators to your component, and have them passed in automatically as your store updates. Let's take an example of `<FilterLink>` component using connect: ```javascript import { connect } from "react-redux"; import { setVisibilityFilter } from "../actions"; import Link from "../components/Link"; const mapStateToProps = (state, ownProps) => ({ active: ownProps.filter === state.visibilityFilter, }); const mapDispatchToProps = (dispatch, ownProps) => ({ onClick: () => dispatch(setVisibilityFilter(ownProps.filter)), }); const FilterLink = connect(mapStateToProps, mapDispatchToProps)(Link); export default FilterLink; ``` Due to it having quite a few performance optimizations and generally being less likely to cause bugs, the Redux developers almost always recommend using `connect()` over accessing the store directly (using context API). ```javascript class MyComponent { someMethod() { doSomethingWith(this.context.store); } } ``` **[⬆ Back to Top](#table-of-contents)** 170. ### What is the difference between component and container in React Redux? **Component** is a class or function component that describes the presentational part of your application. **Container** is an informal term for a component that is connected to a Redux store. Containers _subscribe_ to Redux state updates and _dispatch_ actions, and they usually don't render DOM elements; they delegate rendering to presentational child components. **[⬆ Back to Top](#table-of-contents)** 171. ### What is the purpose of the constants in Redux? Constants allows you to easily find all usages of that specific functionality across the project when you use an IDE. It also prevents you from introducing silly bugs caused by typos – in which case, you will get a `ReferenceError` immediately. Normally we will save them in a single file (`constants.js` or `actionTypes.js`). ```javascript export const ADD_TODO = "ADD_TODO"; export const DELETE_TODO = "DELETE_TODO"; export const EDIT_TODO = "EDIT_TODO"; export const COMPLETE_TODO = "COMPLETE_TODO"; export const COMPLETE_ALL = "COMPLETE_ALL"; export const CLEAR_COMPLETED = "CLEAR_COMPLETED"; ``` In Redux, you use them in two places: 1. **During action creation:** Let's take `actions.js`: ```javascript import { ADD_TODO } from "./actionTypes"; export function addTodo(text) { return { type: ADD_TODO, text }; } ``` 2. **In reducers:** Let's create `reducer.js`: ```javascript import { ADD_TODO } from "./actionTypes"; export default (state = [], action) => { switch (action.type) { case ADD_TODO: return [ ...state, { text: action.text, completed: false, }, ]; default: return state; } }; ``` **[⬆ Back to Top](#table-of-contents)** 172. ### What are the different ways to write `mapDispatchToProps()`? There are a few ways of binding _action creators_ to `dispatch()` in `mapDispatchToProps()`. Below are the possible options: ```javascript const mapDispatchToProps = (dispatch) => ({ action: () => dispatch(action()), }); ``` ```javascript const mapDispatchToProps = (dispatch) => ({ action: bindActionCreators(action, dispatch), }); ``` ```javascript const mapDispatchToProps = { action }; ``` The third option is just a shorthand for the first one. **[⬆ Back to Top](#table-of-contents)** 173. ### What is the use of the `ownProps` parameter in `mapStateToProps()` and `mapDispatchToProps()`? If the `ownProps` parameter is specified, React Redux will pass the props that were passed to the component into your _connect_ functions. So, if you use a connected component: ```jsx harmony import ConnectedComponent from "./containers/ConnectedComponent"; <ConnectedComponent user={"john"} />; ``` The `ownProps` inside your `mapStateToProps()` and `mapDispatchToProps()` functions will be an object: ```javascript { user: "john"; } ``` You can use this object to decide what to return from those functions. **[⬆ Back to Top](#table-of-contents)** 174. ### How to structure Redux top level directories? Most of the applications has several top-level directories as below: 1. **Components**: Used for _dumb_ components unaware of Redux. 2. **Containers**: Used for _smart_ components connected to Redux. 3. **Actions**: Used for all action creators, where file names correspond to part of the app. 4. **Reducers**: Used for all reducers, where files name correspond to state key. 5. **Store**: Used for store initialization. This structure works well for small and medium size apps. **[⬆ Back to Top](#table-of-contents)** 175. ### What is redux-saga? `redux-saga` is a library that aims to make side effects (asynchronous things like data fetching and impure things like accessing the browser cache) in React/Redux applications easier and better. It is available in NPM: ```console $ npm install --save redux-saga ``` **[⬆ Back to Top](#table-of-contents)** 176. ### What is the mental model of redux-saga? _Saga_ is like a separate thread in your application, that's solely responsible for side effects. `redux-saga` is a redux _middleware_, which means this thread can be started, paused and cancelled from the main application with normal Redux actions, it has access to the full Redux application state and it can dispatch Redux actions as well. **[⬆ Back to Top](#table-of-contents)** 177. ### What are the differences between `call()` and `put()` in redux-saga? Both `call()` and `put()` are effect creator functions. `call()` function is used to create effect description, which instructs middleware to call the promise. `put()` function creates an effect, which instructs middleware to dispatch an action to the store. Let's take example of how these effects work for fetching particular user data. ```javascript function* fetchUserSaga(action) { // `call` function accepts rest arguments, which will be passed to `api.fetchUser` function. // Instructing middleware to call promise, it resolved value will be assigned to `userData` variable const userData = yield call(api.fetchUser, action.userId); // Instructing middleware to dispatch corresponding action. yield put({ type: "FETCH_USER_SUCCESS", userData, }); } ``` **[⬆ Back to Top](#table-of-contents)** 178. ### What is Redux Thunk? _Redux Thunk_ middleware allows you to write action creators that return a function instead of an action. The thunk can be used to delay the dispatch of an action, or to dispatch only if a certain condition is met. The inner function receives the store methods `dispatch()` and `getState()` as parameters. **[⬆ Back to Top](#table-of-contents)** 179. ### What are the differences between `redux-saga` and `redux-thunk`? Both _Redux Thunk_ and _Redux Saga_ take care of dealing with side effects. In most of the scenarios, Thunk uses _Promises_ to deal with them, whereas Saga uses _Generators_. Thunk is simple to use and Promises are familiar to many developers, Sagas/Generators are more powerful but you will need to learn them. But both middleware can coexist, so you can start with Thunks and introduce Sagas when/if you need them. **[⬆ Back to Top](#table-of-contents)** 180. ### What is Redux DevTools? _Redux DevTools_ is a live-editing time travel environment for Redux with hot reloading, action replay, and customizable UI. If you don't want to bother with installing Redux DevTools and integrating it into your project, consider using Redux DevTools Extension for Chrome and Firefox. **[⬆ Back to Top](#table-of-contents)** 181. ### What are the features of Redux DevTools? Some of the main features of Redux DevTools are below, 1. Lets you inspect every state and action payload. 2. Lets you go back in time by _cancelling_ actions. 3. If you change the reducer code, each _staged_ action will be re-evaluated. 4. If the reducers throw, you will see during which action this happened, and what the error was. 5. With `persistState()` store enhancer, you can persist debug sessions across page reloads. **[⬆ Back to Top](#table-of-contents)** 182. ### What are Redux selectors and why to use them? _Selectors_ are functions that take Redux state as an argument and return some data to pass to the component. For example, to get user details from the state: ```javascript const getUserData = (state) => state.user.data; ``` These selectors have two main benefits, 1. The selector can compute derived data, allowing Redux to store the minimal possible state 2. The selector is not recomputed unless one of its arguments changes **[⬆ Back to Top](#table-of-contents)** 183. ### What is Redux Form? _Redux Form_ works with React and Redux to enable a form in React to use Redux to store all of its state. Redux Form can be used with raw HTML5 inputs, but it also works very well with common UI frameworks like Material UI, React Widgets and React Bootstrap. **[⬆ Back to Top](#table-of-contents)** 184. ### What are the main features of Redux Form? Some of the main features of Redux Form are: 1. Field values persistence via Redux store. 2. Validation (sync/async) and submission. 3. Formatting, parsing and normalization of field values. **[⬆ Back to Top](#table-of-contents)** 185. ### How to add multiple middlewares to Redux? You can use `applyMiddleware()`. For example, you can add `redux-thunk` and `logger` passing them as arguments to `applyMiddleware()`: ```javascript import { createStore, applyMiddleware } from "redux"; const createStoreWithMiddleware = applyMiddleware( ReduxThunk, logger )(createStore); ``` **[⬆ Back to Top](#table-of-contents)** 186. ### How to set initial state in Redux? You need to pass initial state as second argument to createStore: ```javascript const rootReducer = combineReducers({ todos: todos, visibilityFilter: visibilityFilter, }); const initialState = { todos: [{ id: 123, name: "example", completed: false }], }; const store = createStore(rootReducer, initialState); ``` **[⬆ Back to Top](#table-of-contents)** 187. ### How Relay is different from Redux? Relay is similar to Redux in that they both use a single store. The main difference is that relay only manages state originated from the server, and all access to the state is used via _GraphQL_ queries (for reading data) and mutations (for changing data). Relay caches the data for you and optimizes data fetching for you, by fetching only changed data and nothing more. 188. ### What is an action in Redux? _Actions_ are plain JavaScript objects or payloads of information that send data from your application to your store. They are the only source of information for the store. Actions must have a type property that indicates the type of action being performed. For example, let's take an action which represents adding a new todo item: ``` { type: ADD_TODO, text: 'Add todo item' } ``` **[⬆ Back to Top](#table-of-contents)** ## React Native **[⬆ Back to Top](#table-of-contents)** 188. ### What is the difference between React Native and React? **React** is a JavaScript library, supporting both front end web and being run on the server, for building user interfaces and web applications. **React Native** is a mobile framework that compiles to native app components, allowing you to build native mobile applications (iOS, Android, and Windows) in JavaScript that allows you to use React to build your components, and implements React under the hood. **[⬆ Back to Top](#table-of-contents)** 189. ### How to test React Native apps? React Native can be tested only in mobile simulators like iOS and Android. You can run the app in your mobile using expo app (https://expo.io) Where it syncs using QR code, your mobile and computer should be in same wireless network. **[⬆ Back to Top](#table-of-contents)** 190. ### How to do logging in React Native? You can use `console.log`, `console.warn`, etc. As of React Native v0.29 you can simply run the following to see logs in the console: ``` $ react-native log-ios $ react-native log-android ``` **[⬆ Back to Top](#table-of-contents)** 191. ### How to debug your React Native? Follow the below steps to debug React Native app: 1. Run your application in the iOS simulator. 2. Press `Command + D` and a webpage should open up at `http://localhost:8081/debugger-ui`. 3. Enable _Pause On Caught Exceptions_ for a better debugging experience. 4. Press `Command + Option + I` to open the Chrome Developer tools, or open it via `View` -> `Developer` -> `Developer Tools`. 5. You should now be able to debug as you normally would. ## React supported libraries & Integration **[⬆ Back to Top](#table-of-contents)** 192. ### What is reselect and how it works? _Reselect_ is a **selector library** (for Redux) which uses _memoization_ concept. It was originally written to compute derived data from Redux-like applications state, but it can't be tied to any architecture or library. Reselect keeps a copy of the last inputs/outputs of the last call, and recomputes the result only if one of the inputs changes. If the the same inputs are provided twice in a row, Reselect returns the cached output. It's memoization and cache are fully customizable. **[⬆ Back to Top](#table-of-contents)** 193. ### What is Flow? _Flow_ is a _static type checker_ designed to find type errors in JavaScript. Flow types can express much more fine-grained distinctions than traditional type systems. For example, Flow helps you catch errors involving `null`, unlike most type systems. **[⬆ Back to Top](#table-of-contents)** 194. ### What is the difference between Flow and PropTypes? Flow is a _static analysis tool_ (static checker) which uses a superset of the language, allowing you to add type annotations to all of your code and catch an entire class of bugs at compile time. PropTypes is a _basic type checker_ (runtime checker) which has been patched onto React. It can't check anything other than the types of the props being passed to a given component. If you want more flexible typechecking for your entire project Flow/TypeScript are appropriate choices. **[⬆ Back to Top](#table-of-contents)** 195. ### How to use Font Awesome icons in React? The below steps followed to include Font Awesome in React: 1. Install `font-awesome`: ```console $ npm install --save font-awesome ``` 2. Import `font-awesome` in your `index.js` file: ```javascript import "font-awesome/css/font-awesome.min.css"; ``` 3. Add Font Awesome classes in `className`: ```javascript render() { return <div><i className={'fa fa-spinner'} /></div> } ``` **[⬆ Back to Top](#table-of-contents)** 196. ### What is React Dev Tools? _React Developer Tools_ let you inspect the component hierarchy, including component props and state. It exists both as a browser extension (for Chrome and Firefox), and as a standalone app (works with other environments including Safari, IE, and React Native). The official extensions available for different browsers or environments. 1. **Chrome extension** 2. **Firefox extension** 3. **Standalone app** (Safari, React Native, etc) **[⬆ Back to Top](#table-of-contents)** 197. ### Why is DevTools not loading in Chrome for local files? If you opened a local HTML file in your browser (`file://...`) then you must first open _Chrome Extensions_ and check `Allow access to file URLs`. **[⬆ Back to Top](#table-of-contents)** 198. ### How to use Polymer in React? You need to follow below steps to use Polymer in React, 1. Create a Polymer element: ```jsx harmony <link rel="import" href="../../bower_components/polymer/polymer.html" />; Polymer({ is: "calendar-element", ready: function () { this.textContent = "I am a calendar"; }, }); ``` 2. Create the Polymer component HTML tag by importing it in a HTML document, e.g. import it in the `index.html` of your React application: ```html <link rel="import" href="./src/polymer-components/calendar-element.html" /> ``` 3. Use that element in the JSX file: ```javascript import React from "react"; class MyComponent extends React.Component { render() { return <calendar-element />; } } export default MyComponent; ``` **[⬆ Back to Top](#table-of-contents)** 199. ### What are the advantages of React over Vue.js? React has the following advantages over Vue.js: 1. Gives more flexibility in large apps developing. 2. Easier to test. 3. Suitable for mobile apps creating. 4. More information and solutions available. **Note:** The above list of advantages are purely opinionated and it vary based on the professional experience. But they are helpful as base parameters. **[⬆ Back to Top](#table-of-contents)** 200. ### What is the difference between React and Angular? Let's see the difference between React and Angular in a table format. | React | Angular | | ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | | React is a library and has only the View layer | Angular is a framework and has complete MVC functionality | | React handles rendering on the server side | AngularJS renders only on the client side but Angular 2 and above renders on the server side | | React uses JSX that looks like HTML in JS which can be confusing | Angular follows the template approach for HTML, which makes code shorter and easy to understand | | React Native, which is a React type to build mobile applications are faster and more stable | Ionic, Angular's mobile native app is relatively less stable and slower | | In React, data flows only in one way and hence debugging is easy | In Angular, data flows both way i.e it has two-way data binding between children and parent and hence debugging is often difficult | **Note:** The above list of differences are purely opinionated and it vary based on the professional experience. But they are helpful as base parameters. **[⬆ Back to Top](#table-of-contents)** 201. ### Why React tab is not showing up in DevTools? When the page loads, _React DevTools_ sets a global named `__REACT_DEVTOOLS_GLOBAL_HOOK__`, then React communicates with that hook during initialization. If the website is not using React or if React fails to communicate with DevTools then it won't show up the tab. **[⬆ Back to Top](#table-of-contents)** 202. ### What are Styled Components? `styled-components` is a JavaScript library for styling React applications. It removes the mapping between styles and components, and lets you write actual CSS augmented with JavaScript. **[⬆ Back to Top](#table-of-contents)** 203. ### Give an example of Styled Components? Lets create `<Title>` and `<Wrapper>` components with specific styles for each. ```javascript import React from "react"; import styled from "styled-components"; // Create a <Title> component that renders an <h1> which is centered, red and sized at 1.5em const Title = styled.h1` font-size: 1.5em; text-align: center; color: palevioletred; `; // Create a <Wrapper> component that renders a <section> with some padding and a papayawhip background const Wrapper = styled.section` padding: 4em; background: papayawhip; `; ``` These two variables, `Title` and `Wrapper`, are now components that you can render just like any other react component. ```jsx harmony <Wrapper> <Title>{"Lets start first styled component!"}</Title> </Wrapper> ``` **[⬆ Back to Top](#table-of-contents)** 204. ### What is Relay? Relay is a JavaScript framework for providing a data layer and client-server communication to web applications using the React view layer. **[⬆ Back to Top](#table-of-contents)** 205. ### How to use TypeScript in `create-react-app` application? Starting from react-scripts@2.1.0 or higher, there is a built-in support for typescript. i.e, `create-react-app` now supports typescript natively. You can just pass `--typescript` option as below ```bash npx create-react-app my-app --typescript # or yarn create react-app my-app --typescript ``` But for lower versions of react scripts, just supply `--scripts-version` option as `react-scripts-ts` while you create a new project. `react-scripts-ts` is a set of adjustments to take the standard `create-react-app` project pipeline and bring TypeScript into the mix. Now the project layout should look like the following: ``` my-app/ ├─ .gitignore ├─ images.d.ts ├─ node_modules/ ├─ public/ ├─ src/ │ └─ ... ├─ package.json ├─ tsconfig.json ├─ tsconfig.prod.json ├─ tsconfig.test.json └─ tslint.json ``` ## Miscellaneous **[⬆ Back to Top](#table-of-contents)** 206. ### What are the main features of Reselect library? Let's see the main features of Reselect library, 1. Selectors can compute derived data, allowing Redux to store the minimal possible state. 2. Selectors are efficient. A selector is not recomputed unless one of its arguments changes. 3. Selectors are composable. They can be used as input to other selectors. 207. #### Give an example of Reselect usage? Let's take calculations and different amounts of a shipment order with the simplified usage of Reselect: ```javascript import { createSelector } from "reselect"; const shopItemsSelector = (state) => state.shop.items; const taxPercentSelector = (state) => state.shop.taxPercent; const subtotalSelector = createSelector(shopItemsSelector, (items) => items.reduce((acc, item) => acc + item.value, 0) ); const taxSelector = createSelector( subtotalSelector, taxPercentSelector, (subtotal, taxPercent) => subtotal * (taxPercent / 100) ); export const totalSelector = createSelector( subtotalSelector, taxSelector, (subtotal, tax) => ({ total: subtotal + tax }) ); let exampleState = { shop: { taxPercent: 8, items: [ { name: "apple", value: 1.2 }, { name: "orange", value: 0.95 }, ], }, }; console.log(subtotalSelector(exampleState)); // 2.15 console.log(taxSelector(exampleState)); // 0.172 console.log(totalSelector(exampleState)); // { total: 2.322 } ``` **[⬆ Back to Top](#table-of-contents)** 209. ### Does the statics object work with ES6 classes in React? No, `statics` only works with `React.createClass()`: ```javascript someComponent = React.createClass({ statics: { someMethod: function () { // .. }, }, }); ``` But you can write statics inside ES6+ classes as below, ```javascript class Component extends React.Component { static propTypes = { // ... }; static someMethod() { // ... } } ``` or writing them outside class as below, ```javascript class Component extends React.Component { .... } Component.propTypes = {...} Component.someMethod = function(){....} ``` **[⬆ Back to Top](#table-of-contents)** 210. ### Can Redux only be used with React? Redux can be used as a data store for any UI layer. The most common usage is with React and React Native, but there are bindings available for Angular, Angular 2, Vue, Mithril, and more. Redux simply provides a subscription mechanism which can be used by any other code. **[⬆ Back to Top](#table-of-contents)** 211. ### Do you need to have a particular build tool to use Redux? Redux is originally written in ES6 and transpiled for production into ES5 with Webpack and Babel. You should be able to use it regardless of your JavaScript build process. Redux also offers a UMD build that can be used directly without any build process at all. **[⬆ Back to Top](#table-of-contents)** 212. ### How Redux Form `initialValues` get updated from state? You need to add `enableReinitialize : true` setting. ```javascript const InitializeFromStateForm = reduxForm({ form: "initializeFromState", enableReinitialize: true, })(UserEdit); ``` If your `initialValues` prop gets updated, your form will update too. **[⬆ Back to Top](#table-of-contents)** 213. ### How React PropTypes allow different types for one prop? You can use `oneOfType()` method of `PropTypes`. For example, the height property can be defined with either `string` or `number` type as below: ```javascript Component.propTypes = { size: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), }; ``` **[⬆ Back to Top](#table-of-contents)** 214. ### Can I import an SVG file as react component? You can import SVG directly as component instead of loading it as a file. This feature is available with `react-scripts@2.0.0` and higher. ```jsx harmony import { ReactComponent as Logo } from "./logo.svg"; const App = () => ( <div> {/* Logo is an actual react component */} <Logo /> </div> ); ``` **Note**: Don't forget about the curly braces in the import. **[⬆ Back to Top](#table-of-contents)** 215. ### Why are inline ref callbacks or functions not recommended? If the ref callback is defined as an inline function, it will get called twice during updates, first with null and then again with the DOM element. This is because a new instance of the function is created with each render, so React needs to clear the old ref and set up the new one. ```jsx class UserForm extends Component { handleSubmit = () => { console.log("Input Value is: ", this.input.value); }; render() { return ( <form onSubmit={this.handleSubmit}> <input type="text" ref={(input) => (this.input = input)} /> // Access DOM input in handle submit <button type="submit">Submit</button> </form> ); } } ``` But our expectation is for the ref callback to get called once, when the component mounts. One quick fix is to use the ES7 class property syntax to define the function ```jsx class UserForm extends Component { handleSubmit = () => { console.log("Input Value is: ", this.input.value); }; setSearchInput = (input) => { this.input = input; }; render() { return ( <form onSubmit={this.handleSubmit}> <input type="text" ref={this.setSearchInput} /> // Access DOM input in handle submit <button type="submit">Submit</button> </form> ); } } ``` **Note:** In React v16.3, **[⬆ Back to Top](#table-of-contents)** 216. ### What is render hijacking in react? The concept of render hijacking is the ability to control what a component will output from another component. It means that you decorate your component by wrapping it into a Higher-Order component. By wrapping, you can inject additional props or make other changes, which can cause changing logic of rendering. It does not actually enable hijacking, but by using HOC you make your component behave differently. **[⬆ Back to Top](#table-of-contents)** 217. ### What are HOC factory implementations? There are two main ways of implementing HOCs in React. 1. Props Proxy (PP) and 2. Inheritance Inversion (II). But they follow different approaches for manipulating the _WrappedComponent_. **Props Proxy** In this approach, the render method of the HOC returns a React Element of the type of the WrappedComponent. We also pass through the props that the HOC receives, hence the name **Props Proxy**. ```jsx function ppHOC(WrappedComponent) { return class PP extends React.Component { render() { return <WrappedComponent {...this.props} />; } }; } ``` **Inheritance Inversion** In this approach, the returned HOC class (Enhancer) extends the WrappedComponent. It is called Inheritance Inversion because instead of the WrappedComponent extending some Enhancer class, it is passively extended by the Enhancer. In this way the relationship between them seems **inverse**. ```jsx function iiHOC(WrappedComponent) { return class Enhancer extends WrappedComponent { render() { return super.render(); } }; } ``` **[⬆ Back to Top](#table-of-contents)** 218. ### How to pass numbers to React component? You should be passing the numbers via curly braces({}) where as strings in quotes ```jsx React.render( <User age={30} department={"IT"} />, document.getElementById("container") ); ``` **[⬆ Back to Top](#table-of-contents)** 219. ### Do I need to keep all my state into Redux? Should I ever use react internal state? It is up to the developer's decision, i.e., it is developer's job to determine what kinds of state make up your application, and where each piece of state should live. Some users prefer to keep every single piece of data in Redux, to maintain a fully serializable and controlled version of their application at all times. Others prefer to keep non-critical or UI state, such as “is this dropdown currently open”, inside a component's internal state. Below are the thumb rules to determine what kind of data should be put into Redux 1. Do other parts of the application care about this data? 2. Do you need to be able to create further derived data based on this original data? 3. Is the same data being used to drive multiple components? 4. Is there value to you in being able to restore this state to a given point in time (ie, time travel debugging)? 5. Do you want to cache the data (i.e, use what's in state if it's already there instead of re-requesting it)? **[⬆ Back to Top](#table-of-contents)** 220. ### What is the purpose of registerServiceWorker in React? React creates a service worker for you without any configuration by default. The service worker is a web API that helps you cache your assets and other files so that when the user is offline or on a slow network, he/she can still see results on the screen, as such, it helps you build a better user experience, that's what you should know about service worker for now. It's all about adding offline capabilities to your site. ```jsx import React from "react"; import ReactDOM from "react-dom"; import App from "./App"; import registerServiceWorker from "./registerServiceWorker"; ReactDOM.render(<App />, document.getElementById("root")); registerServiceWorker(); ``` **[⬆ Back to Top](#table-of-contents)** 221. ### What is React memo function? Class components can be restricted from re-rendering when their input props are the same using **PureComponent or shouldComponentUpdate**. Now you can do the same with function components by wrapping them in **React.memo**. ```jsx const MyComponent = React.memo(function MyComponent(props) { /* only rerenders if props change */ }); ``` **[⬆ Back to Top](#table-of-contents)** 222. ### What is React lazy function? The `React.lazy` function lets you render a dynamic import as a regular component. It will automatically load the bundle containing the `OtherComponent` when the component gets rendered. This must return a Promise which resolves to a module with a default export containing a React component. ```jsx const OtherComponent = React.lazy(() => import("./OtherComponent")); function MyComponent() { return ( <div> <OtherComponent /> </div> ); } ``` **Note:** `React.lazy` and `Suspense` is not yet available for server-side rendering. If you want to do code-splitting in a server rendered app, we still recommend React Loadable. **[⬆ Back to Top](#table-of-contents)** 223. ### How to prevent unnecessary updates using setState? You can compare the current value of the state with an existing state value and decide whether to rerender the page or not. If the values are the same then you need to return **null** to stop re-rendering otherwise return the latest state value. For example, the user profile information is conditionally rendered as follows, ```jsx getUserProfile = (user) => { const latestAddress = user.address; this.setState((state) => { if (state.address === latestAddress) { return null; } else { return { title: latestAddress }; } }); }; ``` **[⬆ Back to Top](#table-of-contents)** 224. ### How do you render Array, Strings and Numbers in React 16 Version? **Arrays**: Unlike older releases, you don't need to make sure **render** method return a single element in React16. You are able to return multiple sibling elements without a wrapping element by returning an array. For example, let us take the below list of developers, ```jsx const ReactJSDevs = () => { return [ <li key="1">John</li>, <li key="2">Jackie</li>, <li key="3">Jordan</li>, ]; }; ``` You can also merge this array of items in another array component. ```jsx const JSDevs = () => { return ( <ul> <li>Brad</li> <li>Brodge</li> <ReactJSDevs /> <li>Brandon</li> </ul> ); }; ``` **Strings and Numbers:** You can also return string and number type from the render method. ```jsx render() { return 'Welcome to ReactJS questions'; } // Number render() { return 2018; } ``` **[⬆ Back to Top](#table-of-contents)** 225. ### How to use class field declarations syntax in React classes? React Class Components can be made much more concise using the class field declarations. You can initialize the local state without using the constructor and declare class methods by using arrow functions without the extra need to bind them. Let's take a counter example to demonstrate class field declarations for state without using constructor and methods without binding, ```jsx class Counter extends Component { state = { value: 0 }; handleIncrement = () => { this.setState((prevState) => ({ value: prevState.value + 1, })); }; handleDecrement = () => { this.setState((prevState) => ({ value: prevState.value - 1, })); }; render() { return ( <div> {this.state.value} <button onClick={this.handleIncrement}>+</button> <button onClick={this.handleDecrement}>-</button> </div> ); } } ``` **[⬆ Back to Top](#table-of-contents)** 226. ### What are hooks? Hooks is a special JavaScript function that allows you use state and other React features without writing a class. This pattern has been introduced as a new feature in React 16.8 and helped to isolate the stateful logic from the components. Let's see an example of useState hook: ```jsx import { useState } from "react"; function Example() { // Declare a new state variable, which we'll call "count" const [count, setCount] = useState(0); return ( <> <p>You clicked {count} times</p> <button onClick={() => setCount(count + 1)}>Click me</button> </> ); } ``` **Note:** Hooks can be used inside an existing function component without rewriting the component. **[⬆ Back to Top](#table-of-contents)** 227. ### What rules need to be followed for hooks? You need to follow two rules in order to use hooks, 1. **Call Hooks only at the top level of your react functions:** You shouldn’t call Hooks inside loops, conditions, or nested functions. This will ensure that Hooks are called in the same order each time a component renders and it preserves the state of Hooks between multiple useState and useEffect calls. 2. **Call Hooks from React Functions only:** You shouldn’t call Hooks from regular JavaScript functions. Instead, you should call them from either function components or custom hooks. The eslint plugin named **eslint-plugin-react-hooks** can be used to enforce these two rules. **[⬆ Back to Top](#table-of-contents)** 228. ### How to ensure hooks followed the rules in your project? React team released an ESLint plugin called **eslint-plugin-react-hooks** that enforces these two rules. You can add this plugin to your project using the below command, ```javascript npm install eslint-plugin-react-hooks@next ``` And apply the below config in your ESLint config file, ```javascript // Your ESLint configuration { "plugins": [ // ... "react-hooks" ], "rules": { // ... "react-hooks/rules-of-hooks": "error" } } ``` For example, the linter enforce proper naming convention for hooks. If you rename your custom hooks which as prefix "use" to something else then linter won't allow you to call built-in hooks such as useState, useEffect etc inside of your custom hook anymore. **Note:** This plugin is intended to use in Create React App by default. **[⬆ Back to Top](#table-of-contents)** 229. ### What are the differences between Flux and Redux? Below are the major differences between Flux and Redux | Flux | Redux | | ---------------------------------------------- | ------------------------------------------ | | State is mutable | State is immutable | | The Store contains both state and change logic | The Store and change logic are separate | | There are multiple stores exist | There is only one store exist | | All the stores are disconnected and flat | Single store with hierarchical reducers | | It has a singleton dispatcher | There is no concept of dispatcher | | React components subscribe to the store | Container components uses connect function | **[⬆ Back to Top](#table-of-contents)** 230. ### What are the benefits of React Router V4? Below are the main benefits of React Router V4 module, 1. In React Router v4(version 4), the API is completely about components. A router can be visualized as a single component(`<BrowserRouter>`) which wraps specific child router components(`<Route>`). 2. You don't need to manually set history. The router module will take care history by wrapping routes with `<BrowserRouter>` component. 3. The application size is reduced by adding only the specific router module(Web, core, or native) **[⬆ Back to Top](#table-of-contents)** 231. ### Can you describe about componentDidCatch lifecycle method signature? The **componentDidCatch** lifecycle method is invoked after an error has been thrown by a descendant component. The method receives two parameters, 1. error: - The error object which was thrown 2. info: - An object with a componentStack key contains the information about which component threw the error. The method structure would be as follows ```javascript componentDidCatch(error, info); ``` **[⬆ Back to Top](#table-of-contents)** 232. ### In which scenarios error boundaries do not catch errors? Below are the cases in which error boundaries doesn't work, 1. Inside Event handlers 2. Asynchronous code using **setTimeout or requestAnimationFrame** callbacks 3. During Server side rendering 4. When errors thrown in the error boundary code itself **[⬆ Back to Top](#table-of-contents)** 233. ### Why do you not need error boundaries for event handlers? Error boundaries do not catch errors inside event handlers. React doesn’t need error boundaries to recover from errors in event handlers. Unlike the render method and lifecycle methods, the event handlers don’t happen during rendering. So if they throw, React still knows what to display on the screen. If you need to catch an error inside an event handler, use the regular JavaScript try / catch statement: ```javascript class MyComponent extends React.Component { constructor(props) { super(props); this.state = { error: null }; this.handleClick = this.handleClick.bind(this); } handleClick() { try { // Do something that could throw } catch (error) { this.setState({ error }); } } render() { if (this.state.error) { return <h1>Caught an error.</h1>; } return <button onClick={this.handleClick}>Click Me</button>; } } ``` Note that the above example is demonstrating regular JavaScript behavior and doesn’t use error boundaries. **[⬆ Back to Top](#table-of-contents)** 234. ### What is the difference between try catch block and error boundaries? Try catch block works with imperative code whereas error boundaries are meant for declarative code to render on the screen. For example, the try catch block used for below imperative code ```javascript try { showButton(); } catch (error) { // ... } ``` Whereas error boundaries wrap declarative code as below, ```javascript <ErrorBoundary> <MyComponent /> </ErrorBoundary> ``` So if an error occurs in a **componentDidUpdate** method caused by a **setState** somewhere deep in the tree, it will still correctly propagate to the closest error boundary. **[⬆ Back to Top](#table-of-contents)** 235. ### What is the behavior of uncaught errors in react 16? In React 16, errors that were not caught by any error boundary will result in unmounting of the whole React component tree. The reason behind this decision is that it is worse to leave corrupted UI in place than to completely remove it. For example, it is worse for a payments app to display a wrong amount than to render nothing. **[⬆ Back to Top](#table-of-contents)** 236. ### What is the proper placement for error boundaries? The granularity of error boundaries usage is up to the developer based on project needs. You can follow either of these approaches, 1. You can wrap top-level route components to display a generic error message for the entire application. 2. You can also wrap individual components in an error boundary to protect them from crashing the rest of the application. **[⬆ Back to Top](#table-of-contents)** 237. ### What is the benefit of component stack trace from error boundary? Apart from error messages and javascript stack, React16 will display the component stack trace with file names and line numbers using error boundary concept. For example, BuggyCounter component displays the component stack trace as below, ![stacktrace](images/error_boundary.png) **[⬆ Back to Top](#table-of-contents)** 238. ### What is the required method to be defined for a class component? The `render()` method is the only required method in a class component. i.e, All methods other than render method are optional for a class component. **[⬆ Back to Top](#table-of-contents)** 239. ### What are the possible return types of render method? Below are the list of following types used and return from render method, 1. **React elements:** Elements that instruct React to render a DOM node. It includes html elements such as `<div/>` and user defined elements. 2. **Arrays and fragments:** Return multiple elements to render as Arrays and Fragments to wrap multiple elements 3. **Portals:** Render children into a different DOM subtree. 4. **String and numbers:** Render both Strings and Numbers as text nodes in the DOM 5. **Booleans or null:** Doesn't render anything but these types are used to conditionally render content. **[⬆ Back to Top](#table-of-contents)** 240. ### What is the main purpose of constructor? The constructor is mainly used for two purposes, 1. To initialize local state by assigning object to this.state 2. For binding event handler methods to the instance For example, the below code covers both the above cases, ```javascript constructor(props) { super(props); // Don't call this.setState() here! this.state = { counter: 0 }; this.handleClick = this.handleClick.bind(this); } ``` **[⬆ Back to Top](#table-of-contents)** 241. ### Is it mandatory to define constructor for React component? No, it is not mandatory. i.e, If you don’t initialize state and you don’t bind methods, you don’t need to implement a constructor for your React component. **[⬆ Back to Top](#table-of-contents)** 242. ### What are default props? The _defaultProps_ can be defined as a property on the component to set the default values for the props. These default props are used when props not supplied(i.e., undefined props), but not for null props. That means, If you provide null value then it remains null value. For example, let us create color default prop for the button component, ```javascript function MyButton { // ... } MyButton.defaultProps = { color: "red", }; ``` If `props.color` is not provided then it will set the default value to 'red'. i.e, Whenever you try to access the color prop it uses the default value ```javascript render() { return <MyButton /> ; // props.color will contain red value } ``` **[⬆ Back to Top](#table-of-contents)** 243. ### Why should not call setState in componentWillUnmount? You should not call `setState()` in `componentWillUnmount()` because once a component instance is unmounted, it will never be mounted again. **[⬆ Back to Top](#table-of-contents)** 244. ### What is the purpose of getDerivedStateFromError? This lifecycle method is invoked after an error has been thrown by a descendant component. It receives the error that was thrown as a parameter and should return a value to update state. The signature of the lifecycle method is as follows, ```javascript static getDerivedStateFromError(error) ``` Let us take error boundary use case with the above lifecycle method for demonstration purpose, ```javascript class ErrorBoundary extends React.Component { constructor(props) { super(props); this.state = { hasError: false }; } static getDerivedStateFromError(error) { // Update state so the next render will show the fallback UI. return { hasError: true }; } render() { if (this.state.hasError) { // You can render any custom fallback UI return <h1>Something went wrong.</h1>; } return this.props.children; } } ``` **[⬆ Back to Top](#table-of-contents)** 245. ### What is the methods order when component re-rendered? An update can be caused by changes to props or state. The below methods are called in the following order when a component is being re-rendered. 1. static getDerivedStateFromProps() 2. shouldComponentUpdate() 3. render() 4. getSnapshotBeforeUpdate() 5. componentDidUpdate() **[⬆ Back to Top](#table-of-contents)** 246. ### What are the methods invoked during error handling? Below methods are called when there is an error during rendering, in a lifecycle method, or in the constructor of any child component. 1. static getDerivedStateFromError() 2. componentDidCatch() **[⬆ Back to Top](#table-of-contents)** 247. ### What is the purpose of displayName class property? The displayName string is used in debugging messages. Usually, you don’t need to set it explicitly because it’s inferred from the name of the function or class that defines the component. You might want to set it explicitly if you want to display a different name for debugging purposes or when you create a higher-order component. For example, To ease debugging, choose a display name that communicates that it’s the result of a withSubscription HOC. ```javascript function withSubscription(WrappedComponent) { class WithSubscription extends React.Component { /* ... */ } WithSubscription.displayName = `WithSubscription(${getDisplayName( WrappedComponent )})`; return WithSubscription; } function getDisplayName(WrappedComponent) { return ( WrappedComponent.displayName || WrappedComponent.name || "Component" ); } ``` **[⬆ Back to Top](#table-of-contents)** 248. ### What is the browser support for react applications? React supports all popular browsers, including Internet Explorer 9 and above, although some polyfills are required for older browsers such as IE 9 and IE 10. If you use **es5-shim and es5-sham** polyfill then it even support old browsers that doesn't support ES5 methods. **[⬆ Back to Top](#table-of-contents)** 249. ### What is the purpose of unmountComponentAtNode method? This method is available from react-dom package and it removes a mounted React component from the DOM and clean up its event handlers and state. If no component was mounted in the container, calling this function does nothing. Returns true if a component was unmounted and false if there was no component to unmount. The method signature would be as follows, ```javascript ReactDOM.unmountComponentAtNode(container); ``` **[⬆ Back to Top](#table-of-contents)** 250. ### What is code-splitting? Code-Splitting is a feature supported by bundlers like Webpack and Browserify which can create multiple bundles that can be dynamically loaded at runtime. The react project supports code splitting via dynamic import() feature. For example, in the below code snippets, it will make moduleA.js and all its unique dependencies as a separate chunk that only loads after the user clicks the 'Load' button. **moduleA.js** ```javascript const moduleA = "Hello"; export { moduleA }; ``` **App.js** ```javascript import React, { Component } from "react"; class App extends Component { handleClick = () => { import("./moduleA") .then(({ moduleA }) => { // Use moduleA }) .catch((err) => { // Handle failure }); }; render() { return ( <div> <button onClick={this.handleClick}>Load</button> </div> ); } } export default App; ``` **[⬆ Back to Top](#table-of-contents)** 251. ### What is the benefit of strict mode? The <StrictMode> will be helpful in the below cases 1. Identifying components with **unsafe lifecycle methods**. 2. Warning about **legacy string ref** API usage. 3. Detecting unexpected **side effects**. 4. Detecting **legacy context** API. 5. Warning about deprecated findDOMNode usage **[⬆ Back to Top](#table-of-contents)** 252. ### What are Keyed Fragments? The Fragments declared with the explicit <React.Fragment> syntax may have keys. The general use case is mapping a collection to an array of fragments as below, ```javascript function Glossary(props) { return ( <dl> {props.items.map((item) => ( // Without the `key`, React will fire a key warning <React.Fragment key={item.id}> <dt>{item.term}</dt> <dd>{item.description}</dd> </React.Fragment> ))} </dl> ); } ``` **Note:** key is the only attribute that can be passed to Fragment. In the future, there might be a support for additional attributes, such as event handlers. **[⬆ Back to Top](#table-of-contents)** 253. ### Does React support all HTML attributes? As of React 16, both standard or custom DOM attributes are fully supported. Since React components often take both custom and DOM-related props, React uses the camelCase convention just like the DOM APIs. Let us take few props with respect to standard HTML attributes, ```javascript <div tabIndex="-1" /> // Just like node.tabIndex DOM API <div className="Button" /> // Just like node.className DOM API <input readOnly={true} /> // Just like node.readOnly DOM API ``` These props work similarly to the corresponding HTML attributes, with the exception of the special cases. It also support all SVG attributes. **[⬆ Back to Top](#table-of-contents)** 254. ### What are the limitations with HOCs? Higher-order components come with a few caveats apart from its benefits. Below are the few listed in an order, 1. **Don’t use HOCs inside the render method:** It is not recommended to apply a HOC to a component within the render method of a component. ```javascript render() { // A new version of EnhancedComponent is created on every render // EnhancedComponent1 !== EnhancedComponent2 const EnhancedComponent = enhance(MyComponent); // That causes the entire subtree to unmount/remount each time! return <EnhancedComponent />; } ``` The above code impacts on performance by remounting a component that causes the state of that component and all of its children to be lost. Instead, apply HOCs outside the component definition so that the resulting component is created only once. 2. **Static methods must be copied over:** When you apply a HOC to a component the new component does not have any of the static methods of the original component ```javascript // Define a static method WrappedComponent.staticMethod = function () { /*...*/ }; // Now apply a HOC const EnhancedComponent = enhance(WrappedComponent); // The enhanced component has no static method typeof EnhancedComponent.staticMethod === "undefined"; // true ``` You can overcome this by copying the methods onto the container before returning it, ```javascript function enhance(WrappedComponent) { class Enhance extends React.Component { /*...*/ } // Must know exactly which method(s) to copy :( Enhance.staticMethod = WrappedComponent.staticMethod; return Enhance; } ``` 3. **Refs aren’t passed through:** For HOCs you need to pass through all props to the wrapped component but this does not work for refs. This is because ref is not really a prop similar to key. In this case you need to use the React.forwardRef API **[⬆ Back to Top](#table-of-contents)** 255. ### How to debug forwardRefs in DevTools? **React.forwardRef** accepts a render function as parameter and DevTools uses this function to determine what to display for the ref forwarding component. For example, If you don't name the render function or not using displayName property then it will appear as ”ForwardRef” in the DevTools, ```javascript const WrappedComponent = React.forwardRef((props, ref) => { return <LogProps {...props} forwardedRef={ref} />; }); ``` But If you name the render function then it will appear as **”ForwardRef(myFunction)”** ```javascript const WrappedComponent = React.forwardRef(function myFunction(props, ref) { return <LogProps {...props} forwardedRef={ref} />; }); ``` As an alternative, You can also set displayName property for forwardRef function, ```javascript function logProps(Component) { class LogProps extends React.Component { // ... } function forwardRef(props, ref) { return <LogProps {...props} forwardedRef={ref} />; } // Give this component a more helpful display name in DevTools. // e.g. "ForwardRef(logProps(MyComponent))" const name = Component.displayName || Component.name; forwardRef.displayName = `logProps(${name})`; return React.forwardRef(forwardRef); } ``` **[⬆ Back to Top](#table-of-contents)** 256. ### When component props defaults to true? If you pass no value for a prop, it defaults to true. This behavior is available so that it matches the behavior of HTML. For example, below expressions are equivalent, ```javascript <MyInput autocomplete /> <MyInput autocomplete={true} /> ``` **Note:** It is not recommended to use this approach because it can be confused with the ES6 object shorthand (example, `{name}` which is short for `{name: name}`) **[⬆ Back to Top](#table-of-contents)** 257. ### What is NextJS and major features of it? Next.js is a popular and lightweight framework for static and server‑rendered applications built with React. It also provides styling and routing solutions. Below are the major features provided by NextJS, 1. Server-rendered by default 2. Automatic code splitting for faster page loads 3. Simple client-side routing (page based) 4. Webpack-based dev environment which supports (HMR) 5. Able to implement with Express or any other Node.js HTTP server 6. Customizable with your own Babel and Webpack configurations **[⬆ Back to Top](#table-of-contents)** 258. ### How do you pass an event handler to a component? You can pass event handlers and other functions as props to child components. It can be used in child component as below, ```html <button onClick="{this.handleClick}"></button> ``` **[⬆ Back to Top](#table-of-contents)** 259. ### Is it good to use arrow functions in render methods? Yes, You can use. It is often the easiest way to pass parameters to callback functions. But you need to optimize the performance while using it. ```javascript class Foo extends Component { handleClick() { console.log("Click happened"); } render() { return <button onClick={() => this.handleClick()}>Click Me</button>; } } ``` **Note:** Using an arrow function in render method creates a new function each time the component renders, which may have performance implications **[⬆ Back to Top](#table-of-contents)** 260. ### How to prevent a function from being called multiple times? If you use an event handler such as **onClick or onScroll** and want to prevent the callback from being fired too quickly, then you can limit the rate at which callback is executed. This can be achieved in the below possible ways, 1. **Throttling:** Changes based on a time based frequency. For example, it can be used using \_.throttle lodash function 2. **Debouncing:** Publish changes after a period of inactivity. For example, it can be used using \_.debounce lodash function 3. **RequestAnimationFrame throttling:** Changes based on requestAnimationFrame. For example, it can be used using raf-schd lodash function **[⬆ Back to Top](#table-of-contents)** 261. ### How JSX prevents Injection Attacks? React DOM escapes any values embedded in JSX before rendering them. Thus it ensures that you can never inject anything that’s not explicitly written in your application. Everything is converted to a string before being rendered. For example, you can embed user input as below, ```javascript const name = response.potentiallyMaliciousInput; const element = <h1>{name}</h1>; ``` This way you can prevent XSS(Cross-site-scripting) attacks in the application. **[⬆ Back to Top](#table-of-contents)** 262. ### How do you update rendered elements? You can update UI(represented by rendered element) by passing the newly created element to ReactDOM's render method. For example, lets take a ticking clock example, where it updates the time by calling render method multiple times, ```javascript function tick() { const element = ( <div> <h1>Hello, world!</h1> <h2>It is {new Date().toLocaleTimeString()}.</h2> </div> ); ReactDOM.render(element, document.getElementById("root")); } setInterval(tick, 1000); ``` **[⬆ Back to Top](#table-of-contents)** 263. ### How do you say that props are readonly? When you declare a component as a function or a class, it must never modify its own props. Let us take a below capital function, ```javascript function capital(amount, interest) { return amount + interest; } ``` The above function is called “pure” because it does not attempt to change their inputs, and always return the same result for the same inputs. Hence, React has a single rule saying "All React components must act like pure functions with respect to their props." **[⬆ Back to Top](#table-of-contents)** 264. ### How do you say that state updates are merged? When you call setState() in the component, React merges the object you provide into the current state. For example, let us take a facebook user with posts and comments details as state variables, ```javascript constructor(props) { super(props); this.state = { posts: [], comments: [] }; } ``` Now you can update them independently with separate `setState()` calls as below, ```javascript componentDidMount() { fetchPosts().then(response => { this.setState({ posts: response.posts }); }); fetchComments().then(response => { this.setState({ comments: response.comments }); }); } ``` As mentioned in the above code snippets, `this.setState({comments})` updates only comments variable without modifying or replacing `posts` variable. **[⬆ Back to Top](#table-of-contents)** 265. ### How do you pass arguments to an event handler? During iterations or loops, it is common to pass an extra parameter to an event handler. This can be achieved through arrow functions or bind method. Let us take an example of user details updated in a grid, ```javascript <button onClick={(e) => this.updateUser(userId, e)}>Update User details</button> <button onClick={this.updateUser.bind(this, userId)}>Update User details</button> ``` In the both approaches, the synthetic argument `e` is passed as a second argument. You need to pass it explicitly for arrow functions and it will be passed automatically for `bind` method. **[⬆ Back to Top](#table-of-contents)** 266. ### How to prevent component from rendering? You can prevent component from rendering by returning null based on specific condition. This way it can conditionally render component. ```javascript function Greeting(props) { if (!props.loggedIn) { return null; } return <div className="greeting">welcome, {props.name}</div>; } ``` ```javascript class User extends React.Component { constructor(props) { super(props); this.state = {loggedIn: false, name: 'John'}; } render() { return ( <div> //Prevent component render if it is not loggedIn <Greeting loggedIn={this.state.loggedIn} /> <UserDetails name={this.state.name}> </div> ); } ``` In the above example, the `greeting` component skips its rendering section by applying condition and returning null value. **[⬆ Back to Top](#table-of-contents)** 267. ### What are the conditions to safely use the index as a key? There are three conditions to make sure, it is safe use the index as a key. 1. The list and items are static– they are not computed and do not change 2. The items in the list have no ids 3. The list is never reordered or filtered. **[⬆ Back to Top](#table-of-contents)** 268. ### Should keys be globally unique? The keys used within arrays should be unique among their siblings but they don’t need to be globally unique. i.e, You can use the same keys with two different arrays. For example, the below `Book` component uses two arrays with different arrays, ```javascript function Book(props) { const index = ( <ul> {props.pages.map((page) => ( <li key={page.id}>{page.title}</li> ))} </ul> ); const content = props.pages.map((page) => ( <div key={page.id}> <h3>{page.title}</h3> <p>{page.content}</p> <p>{page.pageNumber}</p> </div> )); return ( <div> {index} <hr /> {content} </div> ); } ``` **[⬆ Back to Top](#table-of-contents)** 269. ### What is the popular choice for form handling? `Formik` is a form library for react which provides solutions such as validation, keeping track of the visited fields, and handling form submission. In detail, You can categorize them as follows, 1. Getting values in and out of form state 2. Validation and error messages 3. Handling form submission It is used to create a scalable, performant, form helper with a minimal API to solve annoying stuff. **[⬆ Back to Top](#table-of-contents)** 270. ### What are the advantages of formik over redux form library? Below are the main reasons to recommend formik over redux form library, 1. The form state is inherently short-term and local, so tracking it in Redux (or any kind of Flux library) is unnecessary. 2. Redux-Form calls your entire top-level Redux reducer multiple times ON EVERY SINGLE KEYSTROKE. This way it increases input latency for large apps. 3. Redux-Form is 22.5 kB minified gzipped whereas Formik is 12.7 kB **[⬆ Back to Top](#table-of-contents)** 271. ### Why are you not required to use inheritance? In React, it is recommended to use composition over inheritance to reuse code between components. Both Props and composition give you all the flexibility you need to customize a component’s look and behavior explicitly and safely. Whereas, If you want to reuse non-UI functionality between components, it is suggested to extract it into a separate JavaScript module. Later components import it and use that function, object, or class, without extending it. **[⬆ Back to Top](#table-of-contents)** 272. ### Can I use web components in react application? Yes, you can use web components in a react application. Even though many developers won't use this combination, it may require especially if you are using third-party UI components that are written using Web Components. For example, let us use `Vaadin` date picker web component as below, ```javascript import React, { Component } from "react"; import "./App.css"; import "@vaadin/vaadin-date-picker"; class App extends Component { render() { return ( <div className="App"> <vaadin-date-picker label="When were you born?"></vaadin-date-picker> </div> ); } } export default App; ``` **[⬆ Back to Top](#table-of-contents)** 273. ### What is dynamic import? You can achieve code-splitting in your app using dynamic import. Let's take an example of addition, 1. **Normal Import** ```javascript import { add } from "./math"; console.log(add(10, 20)); ``` 2. **Dynamic Import** ```javascript import("./math").then((math) => { console.log(math.add(10, 20)); }); ``` **[⬆ Back to Top](#table-of-contents)** 274. ### What are loadable components? If you want to do code-splitting in a server rendered app, it is recommend to use Loadable Components because React.lazy and Suspense is not yet available for server-side rendering. Loadable lets you render a dynamic import as a regular component. Lets take an example, ```javascript import loadable from "@loadable/component"; const OtherComponent = loadable(() => import("./OtherComponent")); function MyComponent() { return ( <div> <OtherComponent /> </div> ); } ``` Now OtherComponent will be loaded in a separated bundle **[⬆ Back to Top](#table-of-contents)** 275. ### What is suspense component? If the module containing the dynamic import is not yet loaded by the time parent component renders, you must show some fallback content while you’re waiting for it to load using a loading indicator. This can be done using **Suspense** component. For example, the below code uses suspense component, ```javascript const OtherComponent = React.lazy(() => import("./OtherComponent")); function MyComponent() { return ( <div> <Suspense fallback={<div>Loading...</div>}> <OtherComponent /> </Suspense> </div> ); } ``` As mentioned in the above code, Suspense is wrapped above the lazy component. **[⬆ Back to Top](#table-of-contents)** 276. ### What is route based code splitting? One of the best place to do code splitting is with routes. The entire page is going to re-render at once so users are unlikely to interact with other elements in the page at the same time. Due to this, the user experience won't be disturbed. Let us take an example of route based website using libraries like React Router with React.lazy, ```javascript import { BrowserRouter as Router, Route, Switch } from "react-router-dom"; import React, { Suspense, lazy } from "react"; const Home = lazy(() => import("./routes/Home")); const About = lazy(() => import("./routes/About")); const App = () => ( <Router> <Suspense fallback={<div>Loading...</div>}> <Switch> <Route exact path="/" component={Home} /> <Route path="/about" component={About} /> </Switch> </Suspense> </Router> ); ``` In the above code, the code splitting will happen at each route level. **[⬆ Back to Top](#table-of-contents)** 277. ### Give an example on How to use context? **Context** is designed to share data that can be considered **global** for a tree of React components. For example, in the code below lets manually thread through a “theme” prop in order to style the Button component. ```javascript //Lets create a context with a default theme value "luna" const ThemeContext = React.createContext("luna"); // Create App component where it uses provider to pass theme value in the tree class App extends React.Component { render() { return ( <ThemeContext.Provider value="nova"> <Toolbar /> </ThemeContext.Provider> ); } } // A middle component where you don't need to pass theme prop anymore function Toolbar(props) { return ( <div> <ThemedButton /> </div> ); } // Lets read theme value in the button component to use class ThemedButton extends React.Component { static contextType = ThemeContext; render() { return <Button theme={this.context} />; } } ``` **[⬆ Back to Top](#table-of-contents)** 278. ### What is the purpose of default value in context? The defaultValue argument is only used when a component does not have a matching Provider above it in the tree. This can be helpful for testing components in isolation without wrapping them. Below code snippet provides default theme value as Luna. ```javascript const MyContext = React.createContext(defaultValue); ``` **[⬆ Back to Top](#table-of-contents)** 279. ### How do you use contextType? ContextType is used to consume the context object. The contextType property can be used in two ways, 1. **contextType as property of class:** The contextType property on a class can be assigned a Context object created by React.createContext(). After that, you can consume the nearest current value of that Context type using this.context in any of the lifecycle methods and render function. Lets assign contextType property on MyClass as below, ```javascript class MyClass extends React.Component { componentDidMount() { let value = this.context; /* perform a side-effect at mount using the value of MyContext */ } componentDidUpdate() { let value = this.context; /* ... */ } componentWillUnmount() { let value = this.context; /* ... */ } render() { let value = this.context; /* render something based on the value of MyContext */ } } MyClass.contextType = MyContext; ``` 2. **Static field** You can use a static class field to initialize your contextType using public class field syntax. ```javascript class MyClass extends React.Component { static contextType = MyContext; render() { let value = this.context; /* render something based on the value */ } } ``` **[⬆ Back to Top](#table-of-contents)** 280. ### What is a consumer? A Consumer is a React component that subscribes to context changes. It requires a function as a child which receives current context value as argument and returns a react node. The value argument passed to the function will be equal to the value prop of the closest Provider for this context above in the tree. Lets take a simple example, ```javascript <MyContext.Consumer> {value => /* render something based on the context value */} </MyContext.Consumer> ``` **[⬆ Back to Top](#table-of-contents)** 281. ### How do you solve performance corner cases while using context? The context uses reference identity to determine when to re-render, there are some gotchas that could trigger unintentional renders in consumers when a provider’s parent re-renders. For example, the code below will re-render all consumers every time the Provider re-renders because a new object is always created for value. ```javascript class App extends React.Component { render() { return ( <Provider value={{ something: "something" }}> <Toolbar /> </Provider> ); } } ``` This can be solved by lifting up the value to parent state, ```javascript class App extends React.Component { constructor(props) { super(props); this.state = { value: { something: "something" }, }; } render() { return ( <Provider value={this.state.value}> <Toolbar /> </Provider> ); } } ``` **[⬆ Back to Top](#table-of-contents)** 282. ### What is the purpose of forward ref in HOCs? Refs will not get passed through because ref is not a prop. It is handled differently by React just like **key**. If you add a ref to a HOC, the ref will refer to the outermost container component, not the wrapped component. In this case, you can use Forward Ref API. For example, we can explicitly forward refs to the inner FancyButton component using the React.forwardRef API. The below HOC logs all props, ```javascript function logProps(Component) { class LogProps extends React.Component { componentDidUpdate(prevProps) { console.log("old props:", prevProps); console.log("new props:", this.props); } render() { const { forwardedRef, ...rest } = this.props; // Assign the custom prop "forwardedRef" as a ref return <Component ref={forwardedRef} {...rest} />; } } return React.forwardRef((props, ref) => { return <LogProps {...props} forwardedRef={ref} />; }); } ``` Let's use this HOC to log all props that get passed to our “fancy button” component, ```javascript class FancyButton extends React.Component { focus() { // ... } // ... } export default logProps(FancyButton); ``` Now let's create a ref and pass it to FancyButton component. In this case, you can set focus to button element. ```javascript import FancyButton from "./FancyButton"; const ref = React.createRef(); ref.current.focus(); <FancyButton label="Click Me" handleClick={handleClick} ref={ref} />; ``` **[⬆ Back to Top](#table-of-contents)** 283. ### Is ref argument available for all functions or class components? Regular function or class components don’t receive the ref argument, and ref is not available in props either. The second ref argument only exists when you define a component with React.forwardRef call. **[⬆ Back to Top](#table-of-contents)** 284. ### Why do you need additional care for component libraries while using forward refs? When you start using forwardRef in a component library, you should treat it as a breaking change and release a new major version of your library. This is because your library likely has a different behavior such as what refs get assigned to, and what types are exported. These changes can break apps and other libraries that depend on the old behavior. **[⬆ Back to Top](#table-of-contents)** 285. ### How to create react class components without ES6? If you don’t use ES6 then you may need to use the create-react-class module instead. For default props, you need to define getDefaultProps() as a function on the passed object. Whereas for initial state, you have to provide a separate getInitialState method that returns the initial state. ```javascript var Greeting = createReactClass({ getDefaultProps: function () { return { name: "Jhohn", }; }, getInitialState: function () { return { message: this.props.message }; }, handleClick: function () { console.log(this.state.message); }, render: function () { return <h1>Hello, {this.props.name}</h1>; }, }); ``` **Note:** If you use createReactClass then auto binding is available for all methods. i.e, You don't need to use `.bind(this)` with in constructor for event handlers. **[⬆ Back to Top](#table-of-contents)** 286. ### Is it possible to use react without JSX? Yes, JSX is not mandatory for using React. Actually it is convenient when you don’t want to set up compilation in your build environment. Each JSX element is just syntactic sugar for calling `React.createElement(component, props, ...children)`. For example, let us take a greeting example with JSX, ```javascript class Greeting extends React.Component { render() { return <div>Hello {this.props.message}</div>; } } ReactDOM.render( <Greeting message="World" />, document.getElementById("root") ); ``` You can write the same code without JSX as below, ```javascript class Greeting extends React.Component { render() { return React.createElement("div", null, `Hello ${this.props.message}`); } } ReactDOM.render( React.createElement(Greeting, { message: "World" }, null), document.getElementById("root") ); ``` **[⬆ Back to Top](#table-of-contents)** 287. ### What is diffing algorithm? React needs to use algorithms to find out how to efficiently update the UI to match the most recent tree. The diffing algorithms is generating the minimum number of operations to transform one tree into another. However, the algorithms have a complexity in the order of O(n³) where n is the number of elements in the tree. In this case, displaying 1000 elements would require in the order of one billion comparisons. This is far too expensive. Instead, React implements a heuristic O(n) algorithm based on two assumptions: 1. Two elements of different types will produce different trees. 2. The developer can hint at which child elements may be stable across different renders with a key prop. **[⬆ Back to Top](#table-of-contents)** 288. ### What are the rules covered by diffing algorithm? When diffing two trees, React first compares the two root elements. The behavior is different depending on the types of the root elements. It covers the below rules during reconciliation algorithm, 1. **Elements Of Different Types:** Whenever the root elements have different types, React will tear down the old tree and build the new tree from scratch. For example, elements <a> to <img>, or from <Article> to <Comment> of different types lead a full rebuild. 2. **DOM Elements Of The Same Type:** When comparing two React DOM elements of the same type, React looks at the attributes of both, keeps the same underlying DOM node, and only updates the changed attributes. Lets take an example with same DOM elements except className attribute, ```javascript <div className="show" title="ReactJS" /> <div className="hide" title="ReactJS" /> ``` 3. **Component Elements Of The Same Type:** When a component updates, the instance stays the same, so that state is maintained across renders. React updates the props of the underlying component instance to match the new element, and calls componentWillReceiveProps() and componentWillUpdate() on the underlying instance. After that, the render() method is called and the diff algorithm recurses on the previous result and the new result. 4. **Recursing On Children:** when recursing on the children of a DOM node, React just iterates over both lists of children at the same time and generates a mutation whenever there’s a difference. For example, when adding an element at the end of the children, converting between these two trees works well. ```javascript <ul> <li>first</li> <li>second</li> </ul> <ul> <li>first</li> <li>second</li> <li>third</li> </ul> ``` 5. **Handling keys:** React supports a key attribute. When children have keys, React uses the key to match children in the original tree with children in the subsequent tree. For example, adding a key can make the tree conversion efficient, ```javascript <ul> <li key="2015">Duke</li> <li key="2016">Villanova</li> </ul> <ul> <li key="2014">Connecticut</li> <li key="2015">Duke</li> <li key="2016">Villanova</li> </ul> ``` **[⬆ Back to Top](#table-of-contents)** 289. ### When do you need to use refs? There are few use cases to go for refs, 1. Managing focus, text selection, or media playback. 2. Triggering imperative animations. 3. Integrating with third-party DOM libraries. **[⬆ Back to Top](#table-of-contents)** 290. ### Must prop be named as render for render props? Even though the pattern named render props, you don’t have to use a prop named render to use this pattern. i.e, Any prop that is a function that a component uses to know what to render is technically a “render prop”. Lets take an example with the children prop for render props, ```javascript <Mouse children={(mouse) => ( <p> The mouse position is {mouse.x}, {mouse.y} </p> )} /> ``` Actually children prop doesn’t need to be named in the list of “attributes” in JSX element. Instead, you can keep it directly inside element, ```javascript <Mouse> {(mouse) => ( <p> The mouse position is {mouse.x}, {mouse.y} </p> )} </Mouse> ``` While using this above technique(without any name), explicitly state that children should be a function in your propTypes. ```javascript Mouse.propTypes = { children: PropTypes.func.isRequired, }; ``` **[⬆ Back to Top](#table-of-contents)** 291. ### What are the problems of using render props with pure components? If you create a function inside a render method, it negates the purpose of pure component. Because the shallow prop comparison will always return false for new props, and each render in this case will generate a new value for the render prop. You can solve this issue by defining the render function as instance method. **[⬆ Back to Top](#table-of-contents)** 292. ### How do you create HOC using render props? You can implement most higher-order components (HOC) using a regular component with a render prop. For example, if you would prefer to have a withMouse HOC instead of a <Mouse> component, you could easily create one using a regular <Mouse> with a render prop. ```javascript function withMouse(Component) { return class extends React.Component { render() { return ( <Mouse render={(mouse) => <Component {...this.props} mouse={mouse} />} /> ); } }; } ``` This way render props gives the flexibility of using either pattern. **[⬆ Back to Top](#table-of-contents)** 293. ### What is windowing technique? Windowing is a technique that only renders a small subset of your rows at any given time, and can dramatically reduce the time it takes to re-render the components as well as the number of DOM nodes created. If your application renders long lists of data then this technique is recommended. Both react-window and react-virtualized are popular windowing libraries which provides several reusable components for displaying lists, grids, and tabular data. **[⬆ Back to Top](#table-of-contents)** 294. ### How do you print falsy values in JSX? The falsy values such as false, null, undefined, and true are valid children but they don't render anything. If you still want to display them then you need to convert it to string. Let's take an example on how to convert to a string, ```javascript <div>My JavaScript variable is {String(myVariable)}.</div> ``` **[⬆ Back to Top](#table-of-contents)** 295. ### What is the typical use case of portals? React portals are very useful when a parent component has overflow: hidden or has properties that affect the stacking context (e.g. z-index, position, opacity) and you need to visually “break out” of its container. For example, dialogs, global message notifications, hovercards, and tooltips. **[⬆ Back to Top](#table-of-contents)** 296. ### How do you set default value for uncontrolled component? In React, the value attribute on form elements will override the value in the DOM. With an uncontrolled component, you might want React to specify the initial value, but leave subsequent updates uncontrolled. To handle this case, you can specify a **defaultValue** attribute instead of **value**. ```javascript render() { return ( <form onSubmit={this.handleSubmit}> <label> User Name: <input defaultValue="John" type="text" ref={this.input} /> </label> <input type="submit" value="Submit" /> </form> ); } ``` The same applies for `select` and `textArea` inputs. But you need to use **defaultChecked** for `checkbox` and `radio` inputs. **[⬆ Back to Top](#table-of-contents)** 297. ### What is your favorite React stack? Even though the tech stack varies from developer to developer, the most popular stack is used in react boilerplate project code. It mainly uses Redux and redux-saga for state management and asynchronous side-effects, react-router for routing purpose, styled-components for styling react components, axios for invoking REST api, and other supported stack such as webpack, reselect, ESNext, Babel. You can clone the project https://github.com/react-boilerplate/react-boilerplate and start working on any new react project. **[⬆ Back to Top](#table-of-contents)** 298. ### What is the difference between Real DOM and Virtual DOM? Below are the main differences between Real DOM and Virtual DOM, | Real DOM | Virtual DOM | | ------------------------------------ | ------------------------------------ | | Updates are slow | Updates are fast | | DOM manipulation is very expensive. | DOM manipulation is very easy | | You can update HTML directly. | You Can’t directly update HTML | | It causes too much of memory wastage | There is no memory wastage | | Creates a new DOM if element updates | It updates the JSX if element update | **[⬆ Back to Top](#table-of-contents)** 299. ### How to add Bootstrap to a react application? Bootstrap can be added to your React app in a three possible ways, 1. Using the Bootstrap CDN: This is the easiest way to add bootstrap. Add both bootstrap CSS and JS resources in a head tag. 2. Bootstrap as Dependency: If you are using a build tool or a module bundler such as Webpack, then this is the preferred option for adding Bootstrap to your React application ```javascript npm install bootstrap ``` 3. React Bootstrap Package: In this case, you can add Bootstrap to our React app is by using a package that has rebuilt Bootstrap components to work particularly as React components. Below packages are popular in this category, 1. react-bootstrap 2. reactstrap **[⬆ Back to Top](#table-of-contents)** 300. ### Can you list down top websites or applications using react as front end framework? Below are the `top 10 websites` using React as their front-end framework, 1. Facebook 2. Uber 3. Instagram 4. WhatsApp 5. Khan Academy 6. Airbnb 7. Dropbox 8. Flipboard 9. Netflix 10. PayPal **[⬆ Back to Top](#table-of-contents)** 301. ### Is it recommended to use CSS In JS technique in React? React does not have any opinion about how styles are defined but if you are a beginner then good starting point is to define your styles in a separate \*.css file as usual and refer to them using className. This functionality is not part of React but came from third-party libraries. But If you want to try a different approach(CSS-In-JS) then styled-components library is a good option. **[⬆ Back to Top](#table-of-contents)** 302. ### Do I need to rewrite all my class components with hooks? No. But you can try Hooks in a few components(or new components) without rewriting any existing code. Because there are no plans to remove classes in ReactJS. **[⬆ Back to Top](#table-of-contents)** 303. ### How to fetch data with React Hooks? The effect hook called `useEffect` can be used to fetch data from an API and to set the data in the local state of the component with the useState hook’s update function. Here is an example of fetching a list of react articles from an API using fetch. ```javascript import React from "react"; function App() { const [data, setData] = React.useState({ hits: [] }); React.useEffect(() => { fetch("http://hn.algolia.com/api/v1/search?query=react") .then(response => response.json()) .then(data => setData(data)) }, []); return ( <ul> {data.hits.map((item) => ( <li key={item.objectID}> <a href={item.url}>{item.title}</a> </li> ))} </ul> ); } export default App; ``` A popular way to simplify this is by using the library axios. We provided an empty array as second argument to the useEffect hook to avoid activating it on component updates. This way, it only fetches on component mount. **[⬆ Back to Top](#table-of-contents)** 304. ### Is Hooks cover all use cases for classes? Hooks doesn't cover all use cases of classes but there is a plan to add them soon. Currently there are no Hook equivalents to the uncommon **getSnapshotBeforeUpdate** and **componentDidCatch** lifecycles yet. **[⬆ Back to Top](#table-of-contents)** 305. ### What is the stable release for hooks support? React includes a stable implementation of React Hooks in 16.8 release for below packages 1. React DOM 2. React DOM Server 3. React Test Renderer 4. React Shallow Renderer **[⬆ Back to Top](#table-of-contents)** 306. ### Why do we use array destructuring (square brackets notation) in `useState`? When we declare a state variable with `useState`, it returns a pair — an array with two items. The first item is the current value, and the second is a function that updates the value. Using [0] and [1] to access them is a bit confusing because they have a specific meaning. This is why we use array destructuring instead. For example, the array index access would look as follows: ```javascript var userStateVariable = useState("userProfile"); // Returns an array pair var user = userStateVariable[0]; // Access first item var setUser = userStateVariable[1]; // Access second item ``` Whereas with array destructuring the variables can be accessed as follows: ```javascript const [user, setUser] = useState("userProfile"); ``` **[⬆ Back to Top](#table-of-contents)** 307. ### What are the sources used for introducing hooks? Hooks got the ideas from several different sources. Below are some of them, 1. Previous experiments with functional APIs in the react-future repository 2. Community experiments with render prop APIs such as Reactions Component 3. State variables and state cells in DisplayScript. 4. Subscriptions in Rx. 5. Reducer components in ReasonReact. **[⬆ Back to Top](#table-of-contents)** 308. ### How do you access imperative API of web components? Web Components often expose an imperative API to implement its functions. You will need to use a **ref** to interact with the DOM node directly if you want to access imperative API of a web component. But if you are using third-party Web Components, the best solution is to write a React component that behaves as a **wrapper** for your Web Component. **[⬆ Back to Top](#table-of-contents)** 309. ### What is formik? Formik is a small react form library that helps you with the three major problems, 1. Getting values in and out of form state 2. Validation and error messages 3. Handling form submission **[⬆ Back to Top](#table-of-contents)** 310. ### What are typical middleware choices for handling asynchronous calls in Redux? Some of the popular middleware choices for handling asynchronous calls in Redux eco system are `Redux Thunk, Redux Promise, Redux Saga`. **[⬆ Back to Top](#table-of-contents)** 311. ### Do browsers understand JSX code? No, browsers can't understand JSX code. You need a transpiler to convert your JSX to regular Javascript that browsers can understand. The most widely used transpiler right now is Babel. **[⬆ Back to Top](#table-of-contents)** 312. ### Describe about data flow in react? React implements one-way reactive data flow using props which reduce boilerplate and is easier to understand than traditional two-way data binding. **[⬆ Back to Top](#table-of-contents)** 313. ### What is react scripts? The `react-scripts` package is a set of scripts from the create-react-app starter pack which helps you kick off projects without configuring. The `react-scripts start` command sets up the development environment and starts a server, as well as hot module reloading. **[⬆ Back to Top](#table-of-contents)** 314. ### What are the features of create react app? Below are the list of some of the features provided by create react app. 1. React, JSX, ES6, Typescript and Flow syntax support. 2. Autoprefixed CSS 3. CSS Reset/Normalize 4. A live development server 5. A fast interactive unit test runner with built-in support for coverage reporting 6. A build script to bundle JS, CSS, and images for production, with hashes and sourcemaps 7. An offline-first service worker and a web app manifest, meeting all the Progressive Web App criteria. **[⬆ Back to Top](#table-of-contents)** 315. ### What is the purpose of renderToNodeStream method? The `ReactDOMServer#renderToNodeStream` method is used to generate HTML on the server and send the markup down on the initial request for faster page loads. It also helps search engines to crawl your pages easily for SEO purposes. **Note:** Remember this method is not available in the browser but only server. **[⬆ Back to Top](#table-of-contents)** 316. ### What is MobX? MobX is a simple, scalable and battle tested state management solution for applying functional reactive programming (TFRP). For reactJs application, you need to install below packages, ```bash npm install mobx --save npm install mobx-react --save ``` **[⬆ Back to Top](#table-of-contents)** 317. ### What are the differences between Redux and MobX? Below are the main differences between Redux and MobX, | Topic | Redux | MobX | | ------------- | ------------------------------------------------------------- | ---------------------------------------------------------------------- | | Definition | It is a javascript library for managing the application state | It is a library for reactively managing the state of your applications | | Programming | It is mainly written in ES6 | It is written in JavaScript(ES5) | | Data Store | There is only one large store exist for data storage | There is more than one store for storage | | Usage | Mainly used for large and complex applications | Used for simple applications | | Performance | Need to be improved | Provides better performance | | How it stores | Uses JS Object to store | Uses observable to store the data | **[⬆ Back to Top](#table-of-contents)** 318. ### Should I learn ES6 before learning ReactJS? No, you don’t have to learn es2015/es6 to learn react. But you may find many resources or React ecosystem uses ES6 extensively. Let's see some of the frequently used ES6 features, 1. **Destructuring:** To get props and use them in a component ```javascript // in es 5 var someData = this.props.someData; var dispatch = this.props.dispatch; // in es6 const { someData, dispatch } = this.props; ``` 2. Spread operator: Helps in passing props down into a component ```javascript // in es 5 <SomeComponent someData={this.props.someData} dispatch={this.props.dispatch} /> // in es6 <SomeComponent {...this.props} /> ``` 3. Arrow functions: Makes compact syntax ```javascript // es 5 var users = usersList.map(function (user) { return <li>{user.name}</li>; }); // es 6 const users = usersList.map((user) => <li>{user.name}</li>); ``` **[⬆ Back to Top](#table-of-contents)** 319. ### What is Concurrent Rendering? The Concurrent rendering makes React apps to be more responsive by rendering component trees without blocking the main UI thread. It allows React to interrupt a long-running render to handle a high-priority event. i.e, When you enabled concurrent Mode, React will keep an eye on other tasks that need to be done, and if there's something with a higher priority it will pause what it is currently rendering and let the other task finish first. You can enable this in two ways, ```javascript // 1. Part of an app by wrapping with ConcurrentMode <React.unstable_ConcurrentMode> <Something /> </React.unstable_ConcurrentMode>; // 2. Whole app using createRoot ReactDOM.unstable_createRoot(domNode).render(<App />); ``` **[⬆ Back to Top](#table-of-contents)** 320. ### What is the difference between async mode and concurrent mode? Both refers the same thing. Previously concurrent Mode being referred to as "Async Mode" by React team. The name has been changed to highlight React’s ability to perform work on different priority levels. So it avoids the confusion from other approaches to Async Rendering. **[⬆ Back to Top](#table-of-contents)** 321. ### Can I use javascript urls in react16.9? Yes, you can use javascript: URLs but it will log a warning in the console. Because URLs starting with javascript: are dangerous by including unsanitized output in a tag like `<a href>` and create a security hole. ```javascript const companyProfile = { website: "javascript: alert('Your website is hacked')", }; // It will log a warning <a href={companyProfile.website}>More details</a>; ``` Remember that the future versions will throw an error for javascript URLs. **[⬆ Back to Top](#table-of-contents)** 322. ### What is the purpose of eslint plugin for hooks? The ESLint plugin enforces rules of Hooks to avoid bugs. It assumes that any function starting with ”use” and a capital letter right after it is a Hook. In particular, the rule enforces that, 1. Calls to Hooks are either inside a PascalCase function (assumed to be a component) or another useSomething function (assumed to be a custom Hook). 2. Hooks are called in the same order on every render. **[⬆ Back to Top](#table-of-contents)** 323. ### What is the difference between Imperative and Declarative in React? Imagine a simple UI component, such as a "Like" button. When you tap it, it turns blue if it was previously grey, and grey if it was previously blue. The imperative way of doing this would be: ```javascript if (user.likes()) { if (hasBlue()) { removeBlue(); addGrey(); } else { removeGrey(); addBlue(); } } ``` Basically, you have to check what is currently on the screen and handle all the changes necessary to redraw it with the current state, including undoing the changes from the previous state. You can imagine how complex this could be in a real-world scenario. In contrast, the declarative approach would be: ```javascript if (this.state.liked) { return <blueLike />; } else { return <greyLike />; } ``` Because the declarative approach separates concerns, this part of it only needs to handle how the UI should look in a sepecific state, and is therefore much simpler to understand. **[⬆ Back to Top](#table-of-contents)** 324. ### What are the benefits of using typescript with reactjs? Below are some of the benefits of using typescript with Reactjs, 1. It is possible to use latest JavaScript features 2. Use of interfaces for complex type definitions 3. IDEs such as VS Code was made for TypeScript 4. Avoid bugs with the ease of readability and Validation **[⬆ Back to Top](#table-of-contents)** 325. ### How do you make sure that user remains authenticated on page refresh while using Context API State Management? When a user logs in and reload, to persist the state generally we add the load user action in the useEffect hooks in the main App.js. While using Redux, loadUser action can be easily accessed. **App.js** ```js import { loadUser } from "../actions/auth"; store.dispatch(loadUser()); ``` - But while using **Context API**, to access context in App.js, wrap the AuthState in index.js so that App.js can access the auth context. Now whenever the page reloads, no matter what route you are on, the user will be authenticated as **loadUser** action will be triggered on each re-render. **index.js** ```js import React from "react"; import ReactDOM from "react-dom"; import App from "./App"; import AuthState from "./context/auth/AuthState"; ReactDOM.render( <React.StrictMode> <AuthState> <App /> </AuthState> </React.StrictMode>, document.getElementById("root") ); ``` **App.js** ```js const authContext = useContext(AuthContext); const { loadUser } = authContext; useEffect(() => { loadUser(); }, []); ``` **loadUser** ```js const loadUser = async () => { const token = sessionStorage.getItem("token"); if (!token) { dispatch({ type: ERROR, }); } setAuthToken(token); try { const res = await axios("/api/auth"); dispatch({ type: USER_LOADED, payload: res.data.data, }); } catch (err) { console.error(err); } }; ``` **[⬆ Back to Top](#table-of-contents)** 326. ### What are the benefits of new JSX transform? There are three major benefits of new JSX transform, 1. It is possible to use JSX without importing React packages 2. The compiled output might improve the bundle size in a small amount 3. The future improvements provides the flexibility to reduce the number of concepts to learn React. **[⬆ Back to Top](#table-of-contents)** 327. ### How is the new JSX transform different from old transform?? The new JSX transform doesn’t require React to be in scope. i.e, You don't need to import React package for simple scenarios. Let's take an example to look at the main differences between the old and the new transform, **Old Transform:** ```js import React from "react"; function App() { return <h1>Good morning!!</h1>; } ``` Now JSX transform convert the above code into regular JavaScript as below, ```js import React from "react"; function App() { return React.createElement("h1", null, "Good morning!!"); } ``` **New Transform:** The new JSX transform doesn't require any React imports ```js function App() { return <h1>Good morning!!</h1>; } ``` Under the hood JSX transform compiles to below code ```js import { jsx as _jsx } from "react/jsx-runtime"; function App() { return _jsx("h1", { children: "Good morning!!" }); } ``` **Note:** You still need to import React to use Hooks. **[⬆ Back to Top](#table-of-contents)** 328. ### How do you get redux scaffolding using create-react-app? Redux team has provided official redux+js or redux+typescript templates for create-react-app project. The generated project setup includes, 1. Redux Toolkit and React-Redux dependencies 2. Create and configure Redux store 3. React-Redux `<Provider>` passing the store to React components 4. Small "counter" example to demo how to add redux logic and React-Redux hooks API to interact with the store from components The below commands need to be executed along with template option as below, 5. **Javascript template:** ```js npx create-react-app my-app --template redux ``` 2. **Typescript template:** ```js npx create-react-app my-app --template redux-typescript ``` **[⬆ Back to Top](#table-of-contents)** 329. ### What are React Server components? React Server Component is a way to write React component that gets rendered in the server-side with the purpose of improving React app performance. These components allow us to load components from the backend. **Note:** React Server Components is still under development and not recommended for production yet. **[⬆ Back to Top](#table-of-contents)** 330. ### What is prop drilling? Prop Drilling is the process by which you pass data from one component of the React Component tree to another by going through other components that do not need the data but only help in passing it around. **[⬆ Back to Top](#table-of-contents)** 331. ### What is state mutation and how to prevent it? `State mutation` happens when you try to update the state of a component without actually using `setState` function. This can happen when you are trying to do some computations using a state variable and unknowingly save the result in the same state variable. This is the main reason why it is advised to return new instances of state variables from the reducers by using Object.assign({}, ...) or spread syntax. This can cause unknown issues in the UI as the value of the state variable got updated without telling React to check what all components were being affected from this update and it can cause UI bugs. Ex: ```javascript class A extends React.component { constructor(props) { super(props); this.state = { loading: false } } componentDidMount() { let { loading } = this.state; loading = (() => true)(); // Trying to perform an operation and directly saving in a state variable } ``` **How to prevent it:** Make sure your state variables are immutable by either enforcing immutability by using plugins like Immutable.js, always using `setState` to make updates, and returning new instances in reducers when sending updated state values. **[⬆ Back to Top](#table-of-contents)** 332. ### What is the difference between useState and useRef hook? 1. useState causes components to re-render after state updates whereas useRef doesn’t cause a component to re-render when the value or state changes. Essentially, useRef is like a “box” that can hold a mutable value in its (.current) property. 2. useState allows us to update the state inside components. While useRef allows referencing DOM elements. **[⬆ Back to Top](#table-of-contents)** 333. ### What is a wrapper component? A wrapper in React is a component that wraps or surrounds another component or group of components. It can be used for a variety of purposes such as adding additional functionality, styling, or layout to the wrapped components. For example, consider a simple component that displays a message: ```javascript const Message = ({ text }) => { return <p>{text}</p>; }; ``` We can create a wrapper component that will add a border to the message component: ```javascript const MessageWrapper = (props) => { return ( <div style={{ border: "1px solid black" }}> <Message {...props} /> </div> ); }; ``` Now we can use the MessageWrapper component instead of the Message component and the message will be displayed with a border: ```javascript <MessageWrapper text="Hello World" /> ``` Wrapper component can also accept its own props and pass them down to the wrapped component, for example, we can create a wrapper component that will add a title to the message component: ```javascript const MessageWrapperWithTitle = ({title, ...props}) => { return ( <div> <h3>{title}</h3> <Message {...props} /> </div> ); }; ``` Now we can use the MessageWrapperWithTitle component and pass title props: ```javascript <MessageWrapperWithTitle title="My Message" text="Hello World" /> ``` This way, the wrapper component can add additional functionality, styling, or layout to the wrapped component while keeping the wrapped component simple and reusable. **[⬆ Back to Top](#table-of-contents)** 334. ### What are the differences between useEffect and useLayoutEffect hooks? useEffect and useLayoutEffect are both React hooks that can be used to synchronize a component with an external system, such as a browser API or a third-party library. However, there are some key differences between the two: - Timing: useEffect runs after the browser has finished painting, while useLayoutEffect runs synchronously before the browser paints. This means that useLayoutEffect can be used to measure and update layout in a way that feels more synchronous to the user. - Browser Paint: useEffect allows browser to paint the changes before running the effect, hence it may cause some visual flicker. useLayoutEffect synchronously runs the effect before browser paints and hence it will avoid visual flicker. - Execution Order: The order in which multiple useEffect hooks are executed is determined by React and may not be predictable. However, the order in which multiple useLayoutEffect hooks are executed is determined by the order in which they were called. - Error handling: useEffect has a built-in mechanism for handling errors that occur during the execution of the effect, so that it does not crash the entire application. useLayoutEffect does not have this mechanism, and errors that occur during the execution of the effect will crash the entire application. In general, it's recommended to use useEffect as much as possible, because it is more performant and less prone to errors. useLayoutEffect should only be used when you need to measure or update layout, and you can't achieve the same result using useEffect. **[⬆ Back to Top](#table-of-contents)** 335. ### What are the differences between Functional and Class Components? There are two different ways to create components in ReactJS. The main differences are listed down as below, ## 1. Syntax: The classs components uses ES6 classes to create the components. It uses `render` function to display the HTML content in the webpage. The syntax for class component looks like as below. ```js class App extends Reacts.Component { render(){ return <h1>This is a class component</h1>} } ``` **Note:** The **Pascal Case** is the recommended approach to provide naming to a component. Functional component has been improved over the years with some added features like Hooks. Here is a syntax for functional component. ```js function App(){ return <div className="App"> <h1>Hello, I'm a function component</h1> </div> } ``` ## 2. State: State contains information or data about a component which may change over time. In class component, you can update the state when a user interacts with it or server updates the data using the `setState()` method. The initial state is going to be assigned in the `Constructor( ) `method using the the ` this.state` object and it is possible to different data types in the `this.state` object such as string, boolean, numbers, etc. **A simple example showing how we use the setState() and constructor()** ```js class App extends Component { constructor() { super(); this.state = { message: "This is a class component", }; } updateMessage() { this.setState({t message: "Updating the class component", }); } render() { return ( <> <h1>{this.state.message}</h1> <button onClick={() => { this.updateMessage(); }}> Click!! </button> </> ); } } ``` You not use state in functional components because it was only supported in class components. But over the years hooks have been implemented in functional component which enable to use state in functional component too. The `useState()` hook can used to implement state in funcitonal component. It returns an array with two items: the first item is current state and the next one is a function (setState) that updates the value of the current state. Let's see an example to demonstrate the state in functional components, ```js function App() { const [message, setMessage] = useState("This is a functional component"); const updateMessage = () => { setCountry("Updating the functional component"); }; return ( <div className="App"> <h1>{message} </h1> <button onClick={updateMessage}>Click me!!</button> </div> ); } ``` ## 4. Props: Props are referred to as "properties". The props are passed into react component just like arguments passed to a function. In otherwords, they are similar to HTML attributes. The props are accessible in child class component using `this.props` as shown in below example, ```js class Child extends React.Component { render() { return <h1> This is a functional component and component name is {this.props.name} </h1>; } } class Parent extends React.Component { render() { return ( <div className="Parent"> <Child name="First child component" /> <Child name="Second child component" /> </div> ); } } ``` Props in functional components are similar to that of the class components but the difference is the absence of 'this' keyword. ```js function Child(props) { return <h1>This is a child component and the component name is{props.name}</h1>; } function Parent() { return ( <div className="Parent"> <Child name="First child component" /> <Child name="Second child component" /> </div> ); } ``` **[⬆ Back to Top](#table-of-contents)** 336. ### Why does strict mode render twice in React? StrictMode renders components twice in development mode(not production) in order to detect any problems with your code and warn you about those problems. This is used to detect accidental side effects in the render phase. If you used `create-react-app` development tool then it automatically enables StrictMode by default. ```js ReactDOM.render( <React.StrictMode> {App} </React.StrictMode>, document.getElementById('root') ); ``` If you want to disable this behavior then you can remove `strict` mode. ```js ReactDOM.render( {App}, document.getElementById('root') ); ``` To detect side effects the following functions are invoked twice: 1. Class component constructor, render, and shouldComponentUpdate methods 2. Class component static getDerivedStateFromProps method 3. Function component bodies 4. State updater functions 5. Functions passed to useState, useMemo, or useReducer (any Hook) **[⬆ Back to Top](#table-of-contents)** ## Disclaimer The questions provided in this repository are the summary of frequently asked questions across numerous companies. We cannot guarantee that these questions will actually be asked during your interview process, nor should you focus on memorizing all of them. The primary purpose is for you to get a sense of what some companies might ask — do not get discouraged if you don't know the answer to all of them ⁠— that is ok! Good luck with your interview 😊 ---
null
es6,front-end-development,javascript,reactjs,software-development,webapp
2023-08-02T05:20:33Z
2023-08-02T05:24:49Z
null
1
0
4
0
0
2
null
null
null
AnsarIbrahim/Portfolio-in-3D
development
<a name="readme-top"></a> <div align="center"> <br/> # Portfolio-in-3D ![e2954fb3deb2407e8e4bcb40b1fd6376](https://github.com/AnsarIbrahim/LeaderBoard-new/assets/117971223/9d715e43-a095-4b33-b5f2-161236e8fdcc) </div> <!-- TABLE OF CONTENTS --> # 📗 Table of Contents - [📗 Table of Contents](#-table-of-contents) - [📖 About the Project](#about-project) - [🛠 Built With ](#-built-with-) - [Tech Stack ](#tech-stack-) - [Key Features ](#key-features-) - [🚀 Live Demo ](#-live-demo-) - [💻 Getting Started ](#-getting-started-) - [Prerequisites](#prerequisites) - [Setup](#setup) - [Usage](#usage) - [Deployment ](#deployment-) - [👥 Authors ](#-authors-) - [🔭 Future Features ](#-future-features-) - [🤝 Contributing ](#-contributing-) - [⭐️ Show your support ](#️-show-your-support-) - [🙏 Acknowledgments ](#-acknowledgments-) - [📝 License ](#-license-) <!-- PROJECT DESCRIPTION --> # 📖 [Portfolio-3D] <a name="about-project"></a> Ansar - Full-stack Developer. Passionate about crafting exceptional digital experiences. Explore my diverse projects combining functionality with aesthetics. Let's collaborate and bring your ideas to life! ## 🛠 Built With <a name="built-with"></a> ### Tech Stack <a name="tech-stack"></a> <details> <summary>Client</summary> <ul> <li><a href="https://developer.mozilla.org/en-US/docs/Web/HTML">HTML</a></li> <li><a href="https://developer.mozilla.org/en-US/docs/Web/CSS">CSS</a></li> <li><a href="https://getbootstrap.com/">BOOTSTRAP</a></li> <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript">JavaScript</a></li> <li><a href="https://react.dev/">React</a></li> <li><a href="https://www.youtube.com/@javascriptmastery">JsMastery-Youtube</a></li> <li><a href="https://sketchfab.com/feed">Sketchfab-3D</a></li> <li><a href="https://www.emailjs.com/">Emailjs</a></li> </ul> </details> <!-- Features --> ### Key Features <a name="key-features"></a> - **[3D]** - **[React]** - **[Tailwind]** - **[Portfolio]** <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- LIVE DEMO --> ## 🚀 Live Demo <a name="live-demo"></a> - [Live Demo Link](https://ansaribrahim.netlify.app/) <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- GETTING STARTED --> ## 💻 Getting Started <a name="getting-started"></a> To get a local copy up and running, follow these steps. ### Prerequisites In order to run this project you need: - Install Git on your computer Git - Any text editor VSCode - Install linters on your local environment ### Setup Clone this repository to your desired folder: <br> git clone https://github.com/AnsarIbrahim/Portfolio-in-3D.git <br> cd `Portfolio-in-3D.git` ### Install Install npm: ``` npm install ``` ### Usage Inside your IDE: ``` npm start ``` ## Build for production ``` npm run build ``` ### Deployment <a name="deployment"></a> You can deploy this project using: GitHub Pages <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- AUTHORS --> ## 👥 Authors <a name="authors"></a> 👤 **Ansar Ibrahim** - [GitHub](https://github.com/AnsarIbrahim) - [LinkedIn](www.linkedin.com/in/ansar-ibrahim) - [Twitter](https://twitter.com/ansaradheeb) <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- FUTURE FEATURES --> ## 🔭 Future Features <a name="future-features"></a> - [ ] **[GH-PAGES]** - [ ] **[Projects]** - [ ] **[API]** <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- CONTRIBUTING --> ## 🤝 Contributing <a name="contributing"></a> Contributions, issues, and feature requests are welcome! Feel free to check the [issues page](https://github.com/AnsarIbrahim/Portfolio-in-3D/issues). <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- SUPPORT --> ## ⭐️ Show your support <a name="support"></a> If you like this project give it a ⭐️ <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- ACKNOWLEDGEMENTS --> ## 🙏 Acknowledgments <a name="acknowledgements"></a> I would like to acknowledge and give credit to [JsMastery-Youtube](https://www.youtube.com/@javascriptmastery) <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- LICENSE --> ## 📝 License <a name="license"></a> This project is [MIT](./LICENSE) licensed. <p align="right">(<a href="#readme-top">back to top</a>)</p>
Ansar - Full-stack Developer. Passionate about crafting exceptional digital experiences. Explore my diverse projects combining functionality with aesthetics. Let's collaborate and bring your ideas to life!
bootstrap,css,html,javascript,tailwindcss,gitflow,3d-models,reactjs,vite
2023-08-03T09:33:59Z
2023-10-02T13:42:34Z
null
1
5
21
0
0
2
null
null
JavaScript
JLpensador/Quarto_3D
main
# Quarto_3D Um quarto 3D onde você pode mexer a sua tela para poder movimenta-lo e ver de outros ângulos. <br> Feito com Html, Css e Javascript <br> <br> ![CSS3](https://img.shields.io/badge/css3-%231572B6.svg?style=for-the-badge&logo=css3&logoColor=white) ![HTML5](https://img.shields.io/badge/html5-%23E34F26.svg?style=for-the-badge&logo=html5&logoColor=white) ![JavaScript](https://img.shields.io/badge/javascript-%23323330.svg?style=for-the-badge&logo=javascript&logoColor=%23F7DF1E) ![Visual Studio Code](https://img.shields.io/badge/Visual%20Studio%20Code-0078d7.svg?style=for-the-badge&logo=visual-studio-code&logoColor=white) <br> ![ezgif com-gif-maker (3)](https://github.com/JLpensador/Quarto_3D/assets/127153172/1cc33f53-5ab0-4709-ba27-e1840b7d50ae)
Um quarto 3D onde você pode mexer a sua tela para poder movimenta-lo e ver de outros ângulos. Feito com Html, Css e Javascript
css,html,html5,javascript,html-css,css3,html-css-javascript
2023-07-26T23:31:14Z
2023-10-25T15:24:40Z
null
1
0
5
0
0
2
null
null
CSS
abhyuday1212/Sci-fi.calc
main
# SCI-FI CALC Sci-Fi Calc is a revolutionary scientific calculator that builds upon the standard calculator and takes it to the next level. This project aims to enhance the functionality of a basic calculator by incorporating advanced features like Inverse Trigonometric functions and Logarithmic functions. All the additional functions are conveniently accessible from the buttons section, making complex calculations a breeze. # New Features - Added Inverse Trigonometric functions: sin-1, cos-1, tan-1 - Added Trigonometric functions: sin, cos, tan - Added Reciprocal Trigonometric functions: sec, cosec, cot - Added Exponential functions: x^y, x², ²√ - Added Logarithmic functions: ln, log - Added Factorial function: x! - Added Parentheses support: (, ) - Added Constants: e (Euler's number), 10^x (10 raised to the power x) - Added nth root function: y√x - Added Inverse function: 1/x - Many other additional functions to enhance the user's experience. # Pre-requisites - Sci-Fi Calc should be opened in desktop site for mobiles to be used fluently. - For desktop page the site is made at 100% page view,so for a good experience make your default page size to 100% . # Usage Sci-Fi Calc brings advanced mathematical functions to your fingertips, converting a standard calculator into a powerful scientific calculator. To make the most out of this enhanced tool, follow these usage guidelines: - All the values in " " {double quotes} are button so kindly press them according to assigned sequence ## Trigonometric Functions - For using trigonometric functions like sin, cos, tan, cot, sec, and cosec, first enter the desired value, and then press the corresponding function button to obtain the result. - Syntax : "Input Value" -> "Press the Trigo Function" ## Inverse Trigonometric Functions - To calculate the inverse trigonometric functions (sin-1, cos-1, tan-1), input the value and then press the respective function button. - Syntax : "Input Value" -> "Press Inverse Trigo Function" ## Exponential Function (x^y) - To perform the exponentiation operation (x^y), start by entering the base value (x). Then, press the function button "x^y" and provide the exponent value (y) followed by equal { = } button or {Ans} button to compute the result. - Syntax : "Input Value(1)" -> Press "x^y" -> "Input Value(2)" -> Press "=" or "Ans" ## Special Functions - I - For the following functions (√x, 1/x, x!), input a number as the value of 'x', and then press the corresponding function to obtain the calculated result. - Syntax : "Input Value" -> "Press the above mentioned function" ## Special Functions - II - For the following functions ( x^2, x^3 ), input a number as the value of 'x', and then press the corresponding function followed by equal { = } button or {Ans} button to obtain the calculated result. - Syntax : "Input Value" -> "Press the above mentioned function" -> Press "=" or "Ans" ## logarithmic function - For the following functions ( ln, log), input a number than press the function - Syntax : "Input Value" -> "Press the above mentioned function" ## Brackets Support - Sci-Fi Calc adheres to the BODMAS rule, allowing you to use parentheses for complex expressions and calculations. - Syntax : (2+3)*5=25 ## Power of 10 (10^x) - To calculate the value of 10 raised to the power of 'x', first enter the value of 'x', then press the "10^x" function button to get the result. - Syntax : "Input Value" -> "Press the above mentioned function" ## Nth Root Function (y√x) - For the nth root function, first enter the value of 'y' (root), then press the "y√x" function button, and finally, provide the value of 'x' followed by equal { = } button or {Ans} button to compute the result. - Syntax : "Input Value(1)" -> Press "y√x" -> "Input Value(2)" -> Press "=" or "Ans" ## Percentage Function - For the percentage function, first enter the value than enter percentage button than enter the other value and press equal to. - Its Like what percent of 2 contribute to total of a given number Ex- 2 % 8 = 25 - Syntax : "Input Value(1)" -> Press "%" -> "Input Value(2)" -> Press "=" or "Ans" # Demo - Demo Video https://github-production-user-asset-6210df.s3.amazonaws.com/115206840/255553683-15e265b2-ca25-4cc3-b485-38e9fe68c1a4.mp4 # Screenshots ![Final](https://user-images.githubusercontent.com/115206840/255554445-b80c1c40-7acd-45a3-b24e-10e1e0130519.png) ![Before](https://user-images.githubusercontent.com/115206840/253905921-7e839104-4dc0-48c9-9352-4c02bc5bc3ca.jpg) # Deployment link https://scificalc.netlify.app/ # Installation Clone the GitHub repository. ! https://github.com/abhyuday1212/Sci-fi.calc.git # License [MIT License](LICENSE) # 🚀 About Me Hey folks! 👋 I'm Abhyuday Pratap Singh, a passionate technologist driven by the art of creating immersive and visually captivating web experiences. # 🔗 Contact Me [![portfolio](https://img.shields.io/badge/my_portfolio-000?style=for-the-badge&logo=ko-fi&logoColor=white)](https://linktr.ee/abhyuday12) [![linkedin](https://img.shields.io/badge/linkedin-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/abhyuday12/)
This is a repository for scientific calculator
calculator,css,html5,javascript
2023-07-26T20:04:27Z
2023-08-04T11:42:28Z
2023-07-26T20:09:55Z
1
2
15
0
0
2
null
MIT
JavaScript
kitzen-io/bip39-react-native
main
[![npm version](https://img.shields.io/npm/v/@kitzen/react-native-bip39.svg)](https://www.npmjs.com/package/@kitzen/react-native-bip39) [![from kitzen with Love](https://img.shields.io/badge/from%20kitzen%20with-%F0%9F%A4%8D-red)](https://kitzen.io/) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/kitzen-io/bip39-react-native/blob/master/LICENSE) [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/kitzen-io/bip39-react-native/issues/new) ![test](https://github.com/kitzen-io/bip39-react-native/workflows/build-publish/badge.svg) [![Known Vulnerabilities](https://snyk.io/test/github/kitzen-io/react-native-bip39/badge.svg)](https://snyk.io/test/github/kitzen-io/react-native-bip39) # Bip39 with android support [Bip39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) is an enhancement proposal for the Bitcoin network, enabling the generation of a private key through a set of 12-24 mnemonic words ### Why we need this instead of npm's bip39? Original [bip39](https://github.com/bitcoinjs/bip39) js library requires runtime implementation of crypto, e.g. [v8](https://v8.dev/) provides [globalThis.crypto](https://developer.mozilla.org/en-US/docs/Web/API/crypto_property), but [Hermes](https://reactnative.dev/docs/hermes) doesn't. So this library comes with polyfills for - [buffer](https://developer.mozilla.org/en-US/docs/Glossary/Buffer) - [react-native-crypto](https://www.npmjs.com/package/react-native-crypto) - [react-native-random-bytes](https://www.npmjs.com/package/react-native-randombytes) As native implementation for both from Android and IOS. It was forked from [react-native-bip39](https://github.com/valora-inc/react-native-bip39), but original version have issues with - Dependencies, which are resolved here. E.g. require changed from original code. - Installation tips - Typescript support # Installation 1. Copy paste this block to your package.json: ```json { "dependencies": { "react-native-crypto": "*", "react-native-randombytes": "*" }, "resolutions": { "@kitzen/react-native-bip39/react-native-crypto/pbkdf2": "3.1.2", "@kitzen/react-native-bip39/react-native-crypto/public-encrypt/parse-asn1/pbkdf2": "3.1.2", "@kitzen/react-native-bip39/react-native-random-bytes/buffer": "^6.0.3" } } ``` This is required! - Resolutions are not applied from nested modules. So manual setup is required - Duplicating dependencies is required so react could pull up list of packages it needs to check as native modules, otherwise you'll get [undefined RNRandomBytes.seed](https://stackoverflow.com/questions/67019573/typeerror-null-is-not-an-object-evaluating-rnrandombytes-seed-react-native/76767229#76767229) 2. Install the library ```bash yarn add @kitzen/react-native-bip39 yarn add buffer ^6.0.3 # You must run this manually before running MetroJs server # Otherwise you'll get: "Cannot read properties of undefined (reading 'seed')" cd ./android ./gradlew build cd .. && npm start # metro will not automatically apply native changes. Thus please press 'A' to deploy android ``` 3. Open your `yarn.lock` file and make sure that dependencies are resolved according to [package.json](https://www.npmjs.com/package/@kitzen/react-native-bip39?activeTab=code) resolutions section. # Contributing We deeply appreciate the valuable contributions made by our community. To provide feedback or report bugs, [kindly open a GitHub issue](https://github.com/kitzen-io/bip39-react-native/issues/new). For code contributions, explore our "Contributing" guidelines and become part of our open-source community. Thank you to all the dedicated individuals who contribute; your passion drives our success. Together, we shape the future of web3 industry. <a href="https://github.com/kitzen-io/bip39-react-native/graphs/contributors"> <img src="https://contrib.rocks/image?repo=kitzen-io/bip39-react-native&max=400&columns=20" /> <img src="https://us-central1-tooljet-hub.cloudfunctions.net/github" width="0" height="0" /> </a>
bip39 is an enhancement proposal for the Bitcoin network, enabling the generation of a private key through a set of 12-24 mnemonic words
bip39,bitcoin,blockchain,buffer,javascript,npm,react-native,typescript
2023-07-28T18:47:54Z
2023-08-03T18:23:57Z
null
2
2
31
1
1
2
null
MIT
TypeScript
JLpensador/Pesquisador_de_imagens
main
# Pesquisador_de_imagens Um projeto no qual você pode pesquisar por imagens. <br>Feito com Html, Css, e Javascript <br> <br> ![CSS3](https://img.shields.io/badge/css3-%231572B6.svg?style=for-the-badge&logo=css3&logoColor=white) ![HTML5](https://img.shields.io/badge/html5-%23E34F26.svg?style=for-the-badge&logo=html5&logoColor=white) ![JavaScript](https://img.shields.io/badge/javascript-%23323330.svg?style=for-the-badge&logo=javascript&logoColor=%23F7DF1E) ![Visual Studio Code](https://img.shields.io/badge/Visual%20Studio%20Code-0078d7.svg?style=for-the-badge&logo=visual-studio-code&logoColor=white) ![ezgif com-gif-maker (4)](https://github.com/JLpensador/Pesquisador_de_imagens/assets/127153172/7f4d3fb8-eb86-43ce-8b42-f6d66fc827e8)
Um projeto no qual você pode pesquisar por imagens. Feito com Html, Css, e Javascript
css,css3,html,html-css-javascript,html5,javascript,html-css
2023-08-01T18:02:45Z
2023-10-25T15:23:16Z
null
1
0
5
0
0
2
null
null
CSS
Zel-hub7/Dictionary-App
main
<a name="readme-top"></a> <!-- TABLE OF CONTENTS --> # 📗 Table of Contents - [📗 Table of Contents](#-table-of-contents) - [To Do List ](#to-do-list-) - [🛠 Built With ](#-built-with-) - [Tech Stack ](#tech-stack-) - [Key Features ](#key-features-) - [🚀 Live Demo ](#-live-demo-) - [💻 Getting Started ](#-getting-started-) - [Prerequisites](#prerequisites) - [Setup](#setup) - [Install](#install) - [Usage](#usage) - [Run tests](#run-tests) - [👥 Authors ](#-authors-) - [🤝 Contributing ](#-contributing-) - [⭐️ Show your support ](#️-show-your-support-) - [🙏 Acknowledgments ](#-acknowledgments-) - [📝 License ](#-license-) <!-- PROJECT DESCRIPTION --> # To Do List <a name="about-project"></a> - "This dictionary app provides comprehensive word definitions, includes a pronunciation guide, and features an intuitive user interface for an enhanced language learning experience." ## 🛠 Built With <a name="built-with"></a> ### Tech Stack <a name="tech-stack"></a> - Frontend: HTML, CSS, JavaScript - API: [Dictionary API](https://dictionaryapi.dev/) <details> <summary>Client</summary> <ul> <li><a href="https://developer.mozilla.org/en-US/docs/Web/HTML">HTML</a></li> <li><a href="https://developer.mozilla.org/en-US/docs/Web/CSS">CSS</a></li> <li><a href="https://developer.mozilla.org/en-US/docs/Web/javascript">JavaScript</a></li> </ul> </details> </details> <!-- Features --> ### Key Features <a name="key-features"></a> - Comprehensive Word Definitions: Our dictionary app offers an extensive collection of word definitions and meanings to enrich your language knowledge. - Pronunciation Guide: Enhance your language skills with our app's pronunciation feature, enabling you to listen to the correct pronunciation of words. - User-Friendly Interface: Enjoy a seamless experience with our app's intuitive and easy-to-navigate interface, suitable for users of all levels of tech proficiency. <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- LIVE DEMO --> ## 🚀 Live Demo <a name="live-demo"></a> - <a href = "https://zel-hub7.github.io/Dictionary-App/">Live demo</a> <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- GETTING STARTED --> ## 💻 Getting Started <a name="getting-started"></a> To get a local copy up and running, follow these steps. ### Prerequisites In order to run this project you need: - <a href="https://nodejs.org/en/download">Node.js</a> - <a href="https://docs.npmjs.com/downloading-and-installing-node-js-and-npm">npm</a> ### Setup Clone this repository to your desired folder: ```sh cd desktop git clone https://github.com/Zel-hub7/ToDoList.git ``` ### Install Install this project with: ```sh cd ToDoList npm install ``` ### Usage To run the project write terminal npm run dev. ### Run tests To run the linters, run `npx hint .` and `npx stylelint "**/*.{css,scss}"` or `npx eslint .` from the root directory of the project. <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- AUTHORS --> ## 👥 Authors <a name="authors"></a> 👤 **Zelalem Yohannes * - GitHub: [@Zelalem](https://github.com/Zel-hub7) <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- CONTRIBUTING --> ## 🤝 Contributing <a name="contributing"></a> Contributions, issues, and feature requests are welcome! Feel free to check the [issues page](../../issues/). <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- SUPPORT --> ## ⭐️ Show your support <a name="support"></a> If you like this project, you can contribute to it. You are also welcome to give it a star on GitHub. <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- ACKNOWLEDGEMENTS --> ## 🙏 Acknowledgments <a name="acknowledgements"></a> I would like to thank Microverse for teaching and enforcing professional level practices. <p align="right">(<a href="#readme-top">back to top</a>)</p> <!-- LICENSE --> ## 📝 License <a name="license"></a> This project is <a href ="MIT.md">MIT</a> licensed. <p align="right">(<a href="#readme-top">back to top</a>)</p>
"Discover, learn, and pronounce words effortlessly with our comprehensive dictionary app. Access detailed definitions and listen to correct pronunciations to enrich your language skills."
api,css,javascript
2023-07-31T07:50:41Z
2023-08-07T09:59:45Z
null
1
0
15
1
0
2
null
null
CSS
dodio12138/MeTerminal
main
# MeTerminal >[![Static Badge](https://img.shields.io/badge/%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87-white.svg?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMzAgMjAiPjxkZWZzPjxwYXRoIGlkPSJhIiBkPSJNMC0xTC41ODguODA5LS45NTItLjMwOUguOTUyTC0uNTg4LjgwOXoiIGZpbGw9IiNGRjAiLz48L2RlZnM+PHBhdGggZmlsbD0iI0VFMUMyNSIgZD0iTTAgMGgzMHYyMEgweiIvPjx1c2UgeGxpbms6aHJlZj0iI2EiIHRyYW5zZm9ybT0ibWF0cml4KDMgMCAwIDMgNSA1KSIvPjx1c2UgeGxpbms6aHJlZj0iI2EiIHRyYW5zZm9ybT0icm90YXRlKDIzLjAzNiAuMDkzIDI1LjUzNikiLz48dXNlIHhsaW5rOmhyZWY9IiNhIiB0cmFuc2Zvcm09InJvdGF0ZSg0NS44NyAxLjI3MyAxNi4xOCkiLz48dXNlIHhsaW5rOmhyZWY9IiNhIiB0cmFuc2Zvcm09InJvdGF0ZSg2OS45NDUgLjk5NiAxMi4wNzgpIi8+PHVzZSB4bGluazpocmVmPSIjYSIgdHJhbnNmb3JtPSJyb3RhdGUoMjAuNjYgLTE5LjY4OSAzMS45MzIpIi8+PC9zdmc+&link=https%3A%2F%2Fgithub.com%2Fdodio12138%2FAgainstShortVideos%2Fblob%2Fmain%2Fdocs%2FREADME-ZH.md)](/docs/README-ZH.md) --- ## 📢 Introduction - This is a terminal that uses a webpage to simulate and now it is used to display my resume. - You can visit [it](https://dodio12138.github.io/MeTerminal/src/MePC.html) here. ## ✨ Features - It uses native css and js, no third party libraries or frameworks are used. - Pure css drawing of a faux mackintosh graphic. - Implement terminal printing, character scrolling playback and retro and CRT effects. ## 🔧 Functions >#### Commands
A web page that simulates a terminal
javascript,portfolio,portfolio-website,terminal
2023-07-27T14:17:08Z
2023-08-29T18:27:24Z
null
1
0
33
0
0
2
null
GPL-3.0
JavaScript
BeanyTheCoder/react-signup-form
main
# React Signup Form 📜 A simple signup form built with React.js ## Features ✨ - **Password Strength Checker & Meter**: Real-time feedback on the strength of the chosen password based on 4 criteria: <br> - is 5 or more characters long - contains a capital letter - contains a number - contains a special character(-$&+,:;=?@#!) <br> - **Mild Email Validation**: Basic validation to ensure the email format is correct. - **Cool Design**: An attractive user interface inspired by a YouTube video from Fireship. [Check out the inspiration](https://www.youtube.com/watch?v=yrrw6KdGuxc&list=PPSV). ## Installation & Usage 🛠️ To get started with the React Signup Form, follow these steps: 1. Clone the repository using `git clone https://github.com/BeanyTheCoder/react-signup-form.git`. 2. Navigate to the project directory using `cd react-signup-form`. 3. Install dependencies with `npm install`. 4. Run the app with `npm run dev`. ## Screenshots 📷 _Form image_ ![image of form](./readme-images/form.png) _Form filled image_ ![image of form filled](./readme-images/form-filled.png) ## Links 🔗 Live site link: [here](https://beanythecoder.github.io/react-todo-app/) ## Technologies Used 🛠️ - React.js - HTML & CSS ## License 📝 This project is licensed under the [LICENSE](link-to-license-file). ## Acknowledgments 🙏 - Thanks to [Fireship](https://www.youtube.com/channel/UCsBjURrPoezykLs9EqgamOA) for inspiration for the design of the signup form. - Thanks to [Haikei](https://app.haikei.app/) for the background image. - I used [Glass css](https://css.glass/) for the glassmorphic card ## Contact 📧 For any questions or feedback, feel free to reach out to me at alexanderafoko@gmail.com.
A simple signup form built with React.js
form,javascript,react
2023-08-02T21:03:51Z
2023-10-02T17:15:19Z
null
1
0
18
0
0
2
null
null
JavaScript