React: TypeError: Assignment to constant variable.

Created on 25 Jul 2019  路  12Comments  路  Source: facebook/react

Do you want to request a feature or report a bug?
bug
What is the current behavior?

TypeError: Assignment to constant variable.

image

System: OSX
npm: 6.10.2
node: v10.13.0
react: 16.8.6

All 12 comments

What I think you're trying to is something like this:

const something = 1;
something = 2;

Even though the path implies that the error happens in react, I think the error happens in your code, but it's difficult to tell from a single line. Perhaps you could share a little bit more (error stack)?

Hi @artuross , thank you so much for reply. Sure, here is the screenshot:
image

I don't think I did that const thing....my code is here

@lidaof the error is coming from your code so there is either a typo/bug in what you've written or a problem compiling it. In either case it's not realted to React, and the React issue tracker is for React bugs. I'd recommend bisecting your code, commenting out bits and pieces until the error goes away and you can narrow down which part specifically is breaking it.

Hi @jquense ok....so the problem only happens on build version, it's not happening in development version.......so the code should be fine....

@lidaof I would look at lines 112 and 126 at ArcDisplay.tsx.

I am facing a similar issue today. @lidaof did you find out a solution to fix it?

I am not sure if we have same condition, I updated typescript to 3.4 and create-react-app to 2.1 solved this problem. @shahchaitanya

@lidaof are you using uglify js plugin in Production? This problem is occurred due to this plugin. These links are referred to this bug. I solved this issue by adding inline:false in uglify js compress object.

Thank you for reply @shahchaitanya . I think i did use it, but I don't know where to put this option. I was using react-app-rewire with react-scripts-ts

@lidaof you can configure your web pack in webpack.config.js file. I put this option under webpack.config.js.

thank you @shahchaitanya . I tried that but it's not working for me. Thanks again.

I think there is a simple catch.....if you define it as const you cant change its value. To resolve it just define it by let and try. I was going through a similar error solved it by this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jimfb picture jimfb  路  3Comments

hnordt picture hnordt  路  3Comments

jvorcak picture jvorcak  路  3Comments

zpao picture zpao  路  3Comments

UnbearableBear picture UnbearableBear  路  3Comments