trackExtraHooks cannot set property of #<Object> which has only a getter
See original GitHub issueBy specifying trackExtraHooks
, the following error is thrown.
NOTE: The error is only thrown when running in local machine, NOT in codesandbox.
whyDidYouRender.js:167 Uncaught TypeError: Cannot set property useSelector of #<Object> which has only a getter
at whyDidYouRender.js:167
at Array.forEach (<anonymous>)
at zn (whyDidYouRender.js:150)
at Module../src/index.js (index.js:9)
at __webpack_require__ (bootstrap:785)
at fn (bootstrap:150)
at Object.1 (styles.css?f684:43)
at __webpack_require__ (bootstrap:785)
at checkDeferredModules (bootstrap:45)
at Array.webpackJsonpCallback [as push] (bootstrap:32)
at main.chunk.js:1
(anonymous) @ whyDidYouRender.js:167
zn @ whyDidYouRender.js:150
./src/index.js @ index.js:9
__webpack_require__ @ bootstrap:785
fn @ bootstrap:150
1 @ styles.css?f684:43
__webpack_require__ @ bootstrap:785
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.chunk.js:1
manifest.json:1 Manifest: Line: 1, column: 1, Syntax error.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:34
- Comments:54
Top Results From Across the Web
Cannot set property createElement of #<Object> which is only ...
The main problem is that in the webpack config react module is resolved to preact-compat which apparently does not allow setting new values...
Read more >trackExtraHooks cannot set property of #<Object> which has ...
trackExtraHooks cannot set property of # which has only a getter. ... NOTE: The error is only thrown when running in local machine, ......
Read more >TypeError: setting getter-only property "x" - JavaScript | MDN
TypeError: Cannot set property x of #<Object> which has only a getter (V8-based) TypeError: setting getter-only property "x" (Firefox) TypeError: Attempted ...
Read more >Uncaught TypeError: Cannot set property window of ...
... Cannot set property window of #<Window> which has only a getter ... In JavaScript almost everything is an object, null and undefined...
Read more >Alex Siman - Medium
your code sandbox is broken: TypeError. Cannot set property useSelector of #<Object> which has only a getter.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m using CRA, and I managed to get around it by doing:
if (process.env.NODE_ENV === 'development') { whyDidYouRender(React, { trackAllPureComponents: true, trackHooks: true, trackExtraHooks: [[require('react-redux/lib'), 'useSelector']], }); }
How are we able to fix this without ejecting the webpack config? I am unable to use the library as intended with this issue and IMO it shouldn’t be low priority/wontfix at all as a lot of people use CRA and will probably experience the same issue.