SSFJHGKJFHG
SSFJHGKJFHG

Reputation: 111

How can I import and use only part of a js file in Qwik?

is there a way to have a javascript file that you can import a small part of and then reference in your tsx code via an img tag or otherwise in Qwik? Here's my js code and a way that worked in html.

    __proto__: null,
    _hW: g,
    s_400CzhsbFPA: S,
    s_EquNM0zSbcI: O,
    s_Gbz8OdIVvQQ: E,
    s_OjPGj9VQv0E: P,
    s_zFMyrZAUgYk: I
}, Symbol.toStringTag, {
    value: "Module"
}));
<img .... on:qvisible="banana.js#_hW[2]" >

Here's what I tried to implement in TSX, which didn't work and gave me this error:

import { _hW } from '../js/banana';
const hw = $( _hW );
<img .... onQVisible$={ hw[2] } >

Element implicitly has an 'any' type because expression of type '2' can't be used to index type 'QRL<() => void>'. Property '2' does not exist on type 'QRL<() => void>'.

Upvotes: 0

Views: 50

Answers (0)

Related Questions