Reputation: 1185
I'm trying to implement drag and drop using this tutorial. In this tutorial i have to create a refs like this list = createRef<RecyclerListView<any, any>>()
(line no 55), which is giving me syntex error: unexpected token
. What i understand is that, they are using .tsx extension (don't know what for) but i'm using .js extension, which maybe the reason why this code not working in my end, and not finding any solution of that. Can anyone help me out on that? Thank you
Upvotes: 0
Views: 139
Reputation: 2452
.tsx
extension is for Typescript files. Javascript is not a typed language. To put it simply, Typescript was built to make Javascript look like a typed language. Whatever you put in <>
after createRef
, specifies the type of the ref that is being created and you can only use types in Typescript files (.ts
and .tsx
). If you want to move to Typescript, you'll have to do some setup and change your file extensions to .tsx
. Otherwise, if you'd like to stay on .js
, just ignore the types in the tutorial and instead write list = createRef()
.
Upvotes: 1