Questions tagged [strict-mode]

According to Mozilla Developer Network, ECMAScript 5's strict mode is a way to opt in to a restricted variant of JavaScript. Strict mode isn't just a subset: it intentionally has different semantics from normal code.

Filter by
Sorted by
Tagged with
-4 votes
0 answers
30 views

How to convert the code into pure js code in strict mode? [duplicate]

I tried to write a code for reverse a array. Initially my react application in strict mode and i got the output as, let Number =[1,2,3,4,5,6] initial Array is 654321 Reverse array is 123456 which is ...
Arun Krishna's user avatar
0 votes
1 answer
61 views

Bokeh: major_label_overrides doesn't get updated after CustomJS callback

I have written the code below to make a plot which can be updated when users apply some filters to the data. After selecting a value from the dropdown, the callback updates everything as expected, ...
Jason's user avatar
  • 1
0 votes
1 answer
51 views

Does hoisting of functions behave differently when strict mode is off? [duplicate]

Here are two similiar codes except for the "use strict" part "use strict" { function a() { return 1; } } function a() { return 2; } ...
Alexandr's user avatar
0 votes
0 answers
181 views

Android WebView Error Not Loading angular Webapp

I am running an angular app in android webview but for some reason, the webview does not load the angular app. I have no way of testing as it works perfectly in the browser but fails. The android ...
z123's user avatar
  • 335
-3 votes
2 answers
94 views

How to replace `with` statement in strict mode

This code works optimally and is easily comprehensible: function evalInScope(js, contextAsScope) { //# Return the results of the in-line anonymous function we .call with the passed context ...
kungfooman's user avatar
  • 4,586
0 votes
1 answer
74 views

do I have to remove <React.StrictMode> before creating build file?

I want to create build file for my react app, and I don't want components to render in it two time, so do I have to remove <React.StrictMode> before running following command: npm run build
night_thinker's user avatar
0 votes
1 answer
168 views

Can't deal with POST request + StrictMode

I need to run a POST request only once when I enter the page, the purpose is to validate an user, depending on the response, different content will be shown on the page. I'm using react-query to do ...
Cassiano Matos's user avatar
0 votes
2 answers
88 views

how to prevent react page from rendering twice

i am using react 18 StrictMode and i have some pages in an application while navigating from one page to another page (using Router) an empty page displaying at first and after 2 3 seconds page ...
Harish Mahi's user avatar
0 votes
0 answers
83 views

WebStorm Run/Debug configuration: Adding "--use-strict" as Node parameter does nothing

I am starting to code JavaScript on JetBrains WebStorm, and I am trying to follow a few examples from a book. I am trying to avoid adding use-strict at the start of every code file, knowing fully that ...
Louie_the_unsolver's user avatar
1 vote
1 answer
289 views

Semantic-ui-react Dimmer warning: findDOMNode is deprecated in StrictMode

When I use Dimmer from semantic-ui-react I got this warrning: Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of RefFindNode which is inside StrictMode. Instead, ...
Evgeny's user avatar
  • 913
-2 votes
1 answer
98 views

How can one prevent duplicate setTimeout resulting from complex state change?

I apologize for the complexity of the code this question is based around, but it seems the issue itself is arising from the complexity. I wasn't able to replicate the issue with a simpler example. ...
cyclingLinguist's user avatar
1 vote
1 answer
760 views

'[Symbol.iterator]()' method that returns an iterator

I'm facing this error in my code when using strict mode and I'm not managing it. "message": "Type 'MyType<string>[] | undefined' must have a '[Symbol.iterator]()' method It is ...
cucuru's user avatar
  • 3,494
0 votes
1 answer
115 views

Using React Strict mode with random numbers

I'm trying to create a game of Tic-Tac-Toe with an AI using react. I have a function for my AI that retuns a random row and column to place a piece in. However, when using strict mode the AI takes two ...
lukeyp's user avatar
  • 13
1 vote
2 answers
592 views

How to detect if code runs in browser in TypeScript?

I'm rewriting ES5 JavaScript code into TypeScript and have code like this: var is_browser = (function() { try { return this === window; } catch (e) { return false; } })(); ...
jcubic's user avatar
  • 63k
0 votes
1 answer
397 views

React Strict Mode executing setState Twice breaking code

My app has a cart feature in which the quantity of the items increases every time the user hits the add button. I have the codesandbox linked below. https://codesandbox.io/s/multiple-state-exec-...
Adnan Arif Sait's user avatar
2 votes
1 answer
622 views

findDOMNode is deprecated

On my site (written in React) I use a calendar so that the user can select a date and time range. For this I use the react-advanced-datetimerange-picker library. Also in index.js file I use <React....
Paul's user avatar
  • 103
1 vote
0 answers
196 views

Warning: A string ref, ".$.$.$1", has been found within a strict mode tree

I have a simple react app created using create-react-app and I am using react-stonecutter for my Grid. Getting this error in console when I try to pass data into a list item. Also if I don't use a ...
aahmed31's user avatar
2 votes
1 answer
1k views

What is difference between fragments and strict mode?

My question is apart from obvious difference, what are the main difference between fragment and strict mode?
Shahbaz Raza's user avatar
0 votes
0 answers
447 views

Type 'unknown' is not assignable to other type, when strict mode is true

I have type error. Exists child component Pagination with type of props: interface BaseProps { url: string; rowKey: string; renderItem: (item: unknown) => React.ReactNode; params?: Record&...
Dimitriy's user avatar
1 vote
0 answers
170 views

Is it safe to remove "use strict" from a third party library

I am using a pretty terrible library on the front-end. In their installation instructions, they tell to copy-paste some code, that starts with "use strict". And yet their code throws an ...
Vic Seedoubleyew's user avatar
1 vote
1 answer
327 views

Unexpected state update results in "useState" function

Consider this trivial example where a function is used to update a useState object: App.tsx import { useState } from 'react'; export default function App() { const [state, setState] = useState({ ...
4ae1e1's user avatar
  • 7,324
0 votes
1 answer
218 views

using this in JavaScript module

I wrote the following code (mock up) : module.exports = { test() { console.log('test') }, iffer(nb) { if (nb !== 0) { this.test() } } } I got the ...
Jip Helsen's user avatar
  • 1,102
0 votes
2 answers
790 views

Did not parse stylesheet at 'ionic://localhost/styles.css' because non CSS MIME types are not allowed in strict mode

I'm working on a cross-platform mobile app and using ionic and angular frameworks. My app is running fine on iOS simulators and devices. recently I bought a new Macbook Air with M1 Chip. When I tried ...
Upendra Siripurapu's user avatar
3 votes
1 answer
69 views

Why is toString always running in strict mode?

I know that according to ECMAScript specification, non-strict methods will have thisArg transformed to the global object, if null or undefined was passed to them. That's the reason this code logs the ...
user avatar
2 votes
0 answers
327 views

Angular strict mode, Ngrx, Jamsmine: mock selector with props

I am currently trying to remove the deprecated selectors in my application. This github issue telling us to declare selector with props as a function. Old way (deprecated): export const ...
pred's user avatar
  • 185
3 votes
1 answer
1k views

How to import a library in non-strict mode in strict Angular app?

I'm trying to import jschardet in an Angular 11 project. The current version 3.0.0 does not run in strict mode (throws TypeError at runtime). I tried to reproduce this issue in a minimal example. ...
maiermic's user avatar
  • 4,834
2 votes
2 answers
3k views

Issue with Material-UI Select onChange

I'm using Material-UI select and unable to access select value as I am getting the warning: index.js:1 Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of ...
tonyf's user avatar
  • 34.8k
0 votes
1 answer
60 views

Function Scoped JavaScript Variables ACCESS on a 'NON Strict Mode '

function scoped() { var a = 150; let b = 300; const c = 500; } a = 300; // Why is it possible to access a function scoped variable? b = 600; // Same as above c = 1000; // Same as above and also ...
Frank Montana's user avatar
-1 votes
1 answer
157 views

Fatal error after update MySQL5.6 to MariaDB10.3 - caused by sql strict mode?

My ISP has updated the shared server which hosts my application. It involved an update from MySQL 5.6, to MariaDB 10.3. The ISP writes: MariaDB is largely compatible with MySQL and most web ...
zef's user avatar
  • 649
0 votes
0 answers
1k views

Material UI console warnings in react strict mode

As fast as the application is growing the console is dirty as a footballer shirt. What do I mean? Material UI in strict mode throws warnings like FindDomNode, or to use strings instead of booleans in ...
programmer's user avatar
3 votes
1 answer
285 views

Why filtering objects which has undefined key gives error in TypeScript strict mode

I have this piece of code written in TypeScript with strict mode enabled. const arr: ({ name?: string })[] = [ { name: 'foo' }, {}, { name: 'bar' } ] function select(): string[] { ...
Duc Nguyen's user avatar
0 votes
1 answer
1k views

How can I solve strict mode warning without removing strict mode in react index.js file

When I use <Button /> in below form then it says Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of RefFindNode which is inside StrictMode. Instead, add a ...
Prasanga Thapaliya's user avatar
1 vote
0 answers
75 views

Inquiry on findDOMNode is deprecated in StrictMode

I am new to React and I recently encountered this warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Transition which is inside StrictMode. Instead, add a ref ...
Bins's user avatar
  • 75
4 votes
1 answer
1k views

Warnings with using modals from reactstrap

I have some warnings: Warning: Legacy context API has been detected within a strict-mode tree. The old API will be supported in all 16.x releases, but applications using it should migrate to the new ...
Wiktor Kujawa's user avatar
1 vote
0 answers
487 views

React Js Parsing error: Legacy octal literals are not allowed in strict mode

i'am new to React Js , i have a form where i get a string from the user, i split this string into spaces , then i save it in my state variable this code works fine : handleSubmit(event) { ...
Mysel Crun's user avatar
1 vote
0 answers
471 views

Warning: findDOMNode is deprecated in StrictMode

I get this error when i click on select dropdown field while trying to edit. It says : findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Transition which is inside ...
Nag's user avatar
  • 866
140 votes
4 answers
78k views

material-ui Drawer - findDOMNode is deprecated in StrictMode

I have a simple ReactJS app based on hooks (no classes) using StrictMode. I am using React version 16.13.1 and Material-UI version 4.9.10. In the Appbar I am using Drawer. <div className={...
angus's user avatar
  • 3,240
1 vote
0 answers
580 views

index.js:1 warning findDOMNode

I tried to use import { Button, Form, Input } from 'formik-semantic-ui'; in component Register but I get this warning: Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an ...
Oren Shachar's user avatar
5 votes
2 answers
3k views

react-draft-wysiwyg - Warning: Can't call setState

I did make a simple react app with react-draft-wysiwyg, but I get a warning. import React from "react"; import ReactDOM from "react-dom"; import { Editor } from "react-draft-wysiwyg"; import "../...
Alexander Juhl's user avatar
5 votes
2 answers
3k views

findDOMNode warnings with CSSTransition components

"react": "^16.13.1" "react-transition-group": "^4.3.0" <React.StrictMode> <Router> <App /> </Router> </React.StrictMode> Hi, everyone. I faced with ...
Gorr1995's user avatar
  • 258
4 votes
1 answer
13k views

WARNING: findDOMNode is deprecated in StrictMode, react-redux-notify

I am getting this warning while using, react-redux-notify index.js:1 Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of CSSTransitionGroupChild which is inside ...
raju's user avatar
  • 6,622
0 votes
1 answer
822 views

What is strict mode policy violation in Android

public static void write(byte[] aInput, String aOutputFileName, String dirName) { (new File(dirName)).mkdir(); try { OutputStream output = null; try { output = new ...
Snake4eva's user avatar
-1 votes
1 answer
118 views

JavaScript variable without var inside function not available in Global Execution Context [duplicate]

I learned in one of the kyle simpson's javascript courses that if we declare a variable inside a Javascript function without any prefixing var keyword, then that variable is made available in global ...
finepax007's user avatar
3 votes
0 answers
26 views

Why doesn't Strict Mode throw Syntax Error on duplicated property names? [duplicate]

In JavaScript, Strict Mode is supposed to throw Syntax Error if we try to define object with duplicated properties, like this: const foo = {a: 1, a: 2}; Call me crazy, but I remember it did. Today I ...
Robo Robok's user avatar
  • 21.5k
4 votes
3 answers
3k views

Vue.js - Dynamic inputs breaking in IE11

I'm getting an error when trying to create a dynamic input in Vue when attempting to view my app in IE. The page doesn't load and I get a "Multiple definitions of a property not allowed in strict ...
user3084366's user avatar
  • 1,123
1 vote
1 answer
202 views

JS Strict Mode - Accessing boolean variable

So I've looked all over Stack Overflow and found similar questions, but couldn't find one that I could apply to mine. I'm in strict mode, and I have defined a variable (loaded = false), and trying to ...
Chase Martin's user avatar
1 vote
2 answers
326 views

Is it a good practice to wrap "strict mode" inside an IIFE (self-invoked) expression?

I have one very simply question to ask: Is it a good practice to wrap code inside an IIFE whenever I intend on using "use strict" ? Now, I do understand the usefulness of Scope Closure (answered here ...
Samuel Hulla's user avatar
  • 6,697
1 vote
1 answer
1k views

How can I add "strict" code cheking on ng build (without production flag)?

I am working on a Angular-4 app, it is very robust and it takes forever to compile when I run ng build --prod (or --aot). Most of the time I simply run ng build. Something I have noticed is that ng ...
Multitut's user avatar
  • 2,139
1 vote
2 answers
1k views

Usage of 'use strict' with AngularJS

I am using AngularJS 1.6, Can i use use strict with my Controller, Directives, services, etc. Is it a good practice using 'use strict' with AngularJS app?
asder's user avatar
  • 27
-2 votes
1 answer
125 views

Proper way to write external javascript libraries

I have created a class/library. and I used the new class syntax with a constructor and its methods, now what? what should I put in it for using that in a external JS file? I have something like this ...
Fernando Carvajal's user avatar