Console logging for react?
If you’re just after console logging here’s what I’d do: Shouldn’t be any need for those packages just to do console logging.
If you’re just after console logging here’s what I’d do: Shouldn’t be any need for those packages just to do console logging.
Pure JS You can use fetch optionally with await-try-catch Show code snippet Old school approach – xhr Show code snippet SUMMARY In server side you can read original file name (and other info) which is automatically included to request by browser in filename formData parameter. You do NOT need to set request header Content-Type to multipart/form-data – this will be set automatically by … Read more
See the documentation on MDN about expressions and operators and statements. Basic keywords and general expressions this keyword: How does the “this” keyword work? var x = function() vs. function x() — Function declaration syntax var functionName = function() {} vs function functionName() {} (function(){…})() — IIFE (Immediately Invoked Function Expression) What is the purpose?, How is it called? Why does (function(){…})(); work but function(){…}(); doesn’t? (function(){…})(); vs (function(){…}()); shorter alternatives: !function(){…}(); – What … Read more
Node 13+ Since Node 13, you can use either the .mjs extension, or set {“type”: “module”} in your package.json. You don’t need to use the –experimental-modules flag. Modules is now marked as stable in node.js Node 12 Since Node 12, you can use either the .mjs extension, or set “type”: “module” in your package.json. And you need to run node with the –experimental-modules flag. Node 9 In Node 9, it is enabled behind a flag, and … Read more
The callback is made in a different context. You need to bind to this in order to have access inside the callback: EDIT: Looks like you have to bind both the init and api calls:
The void operator evaluates the given expression and then returns undefined. The void operator is often used merely to obtain the undefined primitive value, usually using “void(0)” (which is equivalent to “void 0”). In these cases, the global variable undefined can be used instead (assuming it has not been assigned to a non-default value). An explanation is provided here: void operator. The reason you’d want to … Read more
stopPropagation prevents further propagation of the current event in the capturing and bubbling phases. preventDefault prevents the default action the browser makes on that event. Examples preventDefault stopPropagation With stopPropagation, only the button‘s click handler is called while the div‘s click handler never fires. Where as if you use preventDefault, only the browser’s default action is stopped but the div’s click handler still … Read more
Here’s a sample on how to use CryptoJs in webclient:
There are some examples on the Mozilla Developer Network page: Here’s the logic behind it. It’s a simple rule of three: Math.random() returns a Number between 0 (inclusive) and 1 (exclusive). So we have an interval like this: Now, we’d like a number between min (inclusive) and max (exclusive): We can use the Math.random to get the correspondent in the [min, max) interval. But, first we … Read more
Dev Tools remembers the last five DOM elements (or JavaScript heap objects) that you’ve selected in the tab (or Profiles panel). It makes those objects available as $0, $1, $2, $3, and $4. $0 returns the most recently selected element or JavaScript object, $1 returns the second most recently selected one, and so on. See this for more information.