Basics API usage
Category: Web
React Notes
Isolate fetch using custome hook: To use this custom hook, you would simply import it into your component and call
React Related Commands
Create a react app npx create-react-app project_name Start development server cd project_name npm start See ESLin configurations npm ls eslint
Accessing Local Devices through Browser
Chrome – WebRTC media-devices //Query Media Devices async function getConnectedDevices(type) { const devices = await navigator.mediaDevices.enumerateDevices(); return devices.filter(device => device.kind
nodejs async examples
Calling async function from sync: async function wait() { await new Promise(resolve => setTimeout(resolve, 1000)); return 10; } function f()
Server side events
Event Source API An EventSource instance opens a persistent connection to an HTTP server, which sends events in text/event-stream format. The connection remains open until closed by calling EventSource.close().
IndexedDB
Shortfall of local storage – Only store string data in localStorage, which are susceptible to XSS attacks, and it does
REACT interview questions
What is “prop drilling” and how to prevent it pass the state as “props” through each nested component UseContext hook
React Hooks
Hooks can only be called inside React function components. Hooks can only be called at the top level of a
React App to AWS Amplify
AWS tutorial Github domain hosting create github repo clone github repo create react app npx create-react-app . 4. add all