I just upgraded from Preact 8 to Preact 10 and I'm getting this error when I run it in the browser.
preact.module.js:1 Uncaught TypeError: Cannot create property 'current' on string 'element'
at A (preact.module.js:1)
at b (preact.module.js:1)
at $ (preact.module.js:1)
at preact.module.js:1
at x (preact.module.js:1)
at x (preact.module.js:1)
at b (preact.module.js:1)
at $ (preact.module.js:1)
at preact.module.js:1
at x (preact.module.js:1)`
Any idea what this error means?
i'm aliasing from 'react' to 'preact/compat' and everything worked fine before I upgraded.
I'll try upgrading to the latest version of Preact to see if that helps.
Hey,
Are you using string refs?
If not could you provide a reproduction?
As far as I'm aware, no. They look like this:
<div ref={(ref) => this.refContainerNode = ref}>
Trying to narrow down the offending code and hope to find out more. Also using redux.
@peterswallow Search for the string element in your app. That's where the error occurs. I think Jovi is right on point. There is something using string-based refs.
Ah yes! I found this one <div ref="element">. Thanks!
Have string refs been deprecated in Preact 10?
Yes, they have been deprecated
The deprecation is not mentioned in the upgrade guide nor CreateRef documentation
https://preactjs.com/guide/v10/upgrade-guide/
https://preactjs.com/guide/v10/refs/#createref
I'll try to add something to the upgrade-guide later
Most helpful comment
Yes, they have been deprecated