Pulling the screensize of the browser dynamically into dash app


i am trying to get javascript variable (which provide the size of the screen dynamically) to use in dash for adjusting the sizes of various components. For this I created a custom react component. Couple of questions here.

  1. Can we do it in any other way like pulling the javascript variable into dash without using the component.

  2. Can we create react component in such a way that the output of the component is just a tuple value (height X width for screensize) with any html Div items.

The react component I created is not working and showing uncaught reference error proptypes not defined error.

Please let me know if you need any further information.


For what regards screen size without needing JS, you might want to have a look to CSS’ vw and vh units.
Does this help you?

Hey have you figued out how to get the variable into dash?