« first day (5064 days earlier)      last day (109 days later) » 

02:57
 
7 hours later…
09:43
is it true that the most reliable way to get the browser window size is window.innerWidth?
 
2 hours later…
12:00
@DimitrisPapageorgiou Yes, but beware, it only gets the window's "width" meaning if you have something obstructing your page (e.g. the dev console) then it would report false readings. It isn't the only way to the window's width, though. For example, you could put a hidden div with 100% width and no margin, and compute it's style in JS to get the width in pixels. However, this is a hacky method to use, so you should just stick with window.innerWidth.
12:14
thanks for clarifying
 
2 hours later…
14:21
why can I not run the codemods from the react repository?
Say I wish to run a mod: npx codemod react/create-element-to-jsx
Even though it is here: github.com/reactjs/react-codemod
I get the following error:
The specified command or codemod name could not be recognized.
To view available commands, execute "codemod --help".
To see a list of existing codemods, run "codemod search" or "codemod list" with a query representing the codemod you are looking for.
 
6 hours later…
20:52
Is there a way to tell typescript to let me assign null to strings?
I have this code:
getListOption(options:[], value:any, property = null, property2 = null) {

	for(var i=0;i<options.length;i++) {
		let option = options[i];

		if (property2) {
			if (option[property][property2]==value) {
				return option;
			}
		}
		else if (property) {
			if (option[property]==value) {
				return option;
			}
		}
		else if (option==value) {
			return option;
		}
	}

	return null;
}
If I type property as a string property:string = null typescript gets upset
Type 'null' is not assignable to type 'string'.ts(2322)
If I set the value to a string it may break all my code
As in property:string = ""
Of course, I believe null is assignable to type string

« first day (5064 days earlier)      last day (109 days later) »