Preact: Uncaught TypeError: value is not a function

Created on 30 May 2017  路  4Comments  路  Source: preactjs/preact

I can't use refs?

<input type="text"  ref="myInput"  placeholder="API Key"   />

I'm getting an error.
I'm using preact-boilerplate.

question

Most helpful comment

This looks like you are using string refs, which are not supported in Preact. Instead you can use a function just like in React, or use the linkRef module for something that looks similar to string refs.

For differences like this between React and Preact, you can check on Differences from React in the official docs for more details.

All 4 comments

This looks like you are using string refs, which are not supported in Preact. Instead you can use a function just like in React, or use the linkRef module for something that looks similar to string refs.

For differences like this between React and Preact, you can check on Differences from React in the official docs for more details.

Note that string refs are deprecated in react too.

Oh, alright. Thanx for guidance!

I somehow never saw this, but since it's in our docs I'll close the issue out. Hopefully anyone searching for the topic finds this helpful issue or the linked doc :)

Was this page helpful?
0 / 5 - 0 ratings