- 5 React Architecture Best Practices
- A plugin system is born... · React Static
- Applying microservices design patterns to scale react app development • Soluto Engineering Blog
- Architecting your React application.
- Best architecture for the React project - Mad Devs
- Build a Super-Modular Todo App with React and Bit Components
- [Building an Enterprise React Application, Part 1 | Lullabot](https://www.lullabot.com/articles/building-an-enterprise-react-ap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
func changeMap(m1 *map[string]int) { | |
m1 = &map[string]int{"hello": 2} | |
} | |
func changeMap2(m2 *map[string]int) { | |
*m2 = map[string]int{"hello": 2} // without dereferencing, Go cannot achieve this | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
// Let's prevent compile-time optimization by using variables | |
a := 0.1 | |
b := 0.2 | |
c := 0.3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To encode microphone audio to flac format in React.js | |
// put encoder.js, libflac3-1.3.2.min.js, libflac3-1.3.2.min.js.mem in public folder | |
// Get necessary files from https://github.com/mmig/speech-to-flac | |
export function FlacAudioRecorder({ onData }) { | |
let recording = false; | |
let stream; | |
let input; | |
let node; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useState } from "react"; | |
import { useSelector } from "react-redux"; | |
/* | |
Instead of JSON.stringifying the array of objects to use as deps in useMemo | |
hook, I've created custom hook that generate serial string which can be used | |
to decide whether filtered result should be updated or not. So, filtered result | |
can be used in useMemo hook without JSON.stringifying. | |
e.g |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* shows a position marker that highlights where the cursor is | |
* @param {object} e - the input or click event that has been fired | |
*/ | |
const showPositionMarker = e => { | |
// grab the input element | |
const { currentTarget: input } = e | |
// create a function that will handle clicking off of the input and hide the marker | |
const processClick = evt => { | |
if (e !== evt && evt.target !== e.target) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* returns x, y coordinates for absolute positioning of a span within a given text input | |
* at a given selection point | |
* @param {object} input - the input element to obtain coordinates for | |
* @param {number} selectionPoint - the selection point for the input | |
*/ | |
const getCursorXY = (input, selectionPoint) => { | |
const { | |
offsetLeft: inputX, | |
offsetTop: inputY, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function* eventIterator(element, eventName, subscribed) { | |
while(true) { | |
yield new Promise(resolve => { | |
const listener = e => { | |
element.removeEventListener(eventName, listener); | |
resolve(e); | |
}; | |
element.addEventListener(eventName, listener); | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* EventRecorder | |
* @class | |
* @classdesc An EventRecorder can record and replay any event on any DOM node | |
* @param {string} [eventName=click] - Name of the events to record | |
* @param {class} [EventClass=MouseEvent] - The class that should be used to recreate the events | |
* @param {object} [context=self] - The context DOM element, the events should be fetched from | |
* @example | |
* // Create a recorder for click events | |
* const clickRecorder = new EventRecorder('click', MouseEvent, window); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
အရင်ကရေးဖူးတယ်။ | |
Global Scope မှာရေးထားတဲ့ JavaScript Function တစ်ခုကို ဘယ်နှနည်းနဲ.ခေါ်လို.ရနိုင်ပါသလဲ :3 | |
function hello() | |
{ | |
console.log("JavaScript"); | |
} | |
hello(); | |
hello.call(); | |
hello.apply(); | |
hello.bind()(); |
NewerOlder