Projectmw Blog
443 FOLLOWERS
Mark Wong is an indie developer working mainly on mobile games at the moment.
Projectmw Blog
3M ago
On your input add this This will only allow number characters This will allow 1 decimal to be added in addition to numbers ..read more
Projectmw Blog
6M ago
I was getting the warning: new NativeEventEmitter() was called with a non-null argument without the required removeListeners method. I was using React Native Sound and to fix the warning I add the below lines of code to this file in the react-native-sound module: react-native-sound/android/src/main/java/com/zmxv/RNSound/RNSoundModule.java ..read more
Projectmw Blog
1y ago
To copy the value of a variable declared using useState, if it’s an array use: let varName = [...stateVar]; If it’s not an array use: let varName = stateVar.valueOf ..read more
Projectmw Blog
1y ago
If you do: let arr = new Array(5); arr.fill([]); This will make an array of 5 identical arrays where editing one will update all which is rarely what anyone wants. To achieve an array of different arrays use: let arr = Array.from(new Array(5), () => ..read more
Projectmw Blog
1y ago
This is mainly for the ‘skip to content’ links. $("a[href^='#']").not("a[href]='#'").click(function() { $("#"+$(this).attr("href").slice(1)+"").focus ..read more
Projectmw Blog
1y ago
var declarations are globally scoped or function scoped while let and const are block scoped. This means you can declare the a let or const with the same name inside an if statement and it will be self contained. The console would log “aa bb” followed by “a b”. Let and const can’t be redeclared in ..read more
Projectmw Blog
1y ago
Triggers when the HTML is ready. Use this to start running code as soon as possible. This is not jQuery. Trigger when everything on the page (eg images) is finished loading ..read more
Projectmw Blog
1y ago
CSS modules allow you to create unique class names even when the class is already used in another file. Name the file like so: name.module.css. Right normal css in it. Import the file like so: Apply it to an element like so: where testClass is a class specified in your css module file. When the ..read more