https://linen.dev logo
Join Discord
Powered by
# react
  • a

    ambitious-knife-25690

    07/20/2021, 2:16 PM
    they work seamlessly now with code updates
  • a

    ambitious-knife-25690

    07/21/2021, 11:20 AM
    I'm sure this used to work
  • a

    ambitious-knife-25690

    07/21/2021, 11:21 AM
    static inline var Group:ReactType = CheckboxGroup;
  • a

    ambitious-knife-25690

    07/21/2021, 11:21 AM
    to allow use like:
    <Checkbox.Group>
  • a

    ambitious-knife-25690

    07/21/2021, 11:21 AM
    Getting the error
    Extern variable initialization must be a constant value
  • u

    user

    07/21/2021, 11:30 AM
    What's CheckboxGroup ?
  • u

    user

    07/21/2021, 11:30 AM
    Also, do you happen to have an enum with a constructor named CheckboxGroup ?
  • a

    ambitious-knife-25690

    07/21/2021, 11:43 AM
    i do not
  • u

    user

    07/21/2021, 11:45 AM
    Hmm, does it work without
    :ReactType
    ?
  • a

    ambitious-knife-25690

    07/21/2021, 12:05 PM
    oh hey
  • a

    ambitious-knife-25690

    07/21/2021, 12:05 PM
    it does lol
  • a

    ambitious-knife-25690

    07/21/2021, 12:08 PM
    thanks!
  • a

    ambitious-knife-25690

    07/22/2021, 11:02 AM
  • a

    ambitious-knife-25690

    07/22/2021, 11:02 AM
    I'm having trouble creating an extern for this
  • a

    ambitious-knife-25690

    07/22/2021, 11:02 AM
    it seems like having
    useToast
    or
    useToast()
    leads to errors both ways
  • a

    ambitious-knife-25690

    07/22/2021, 11:05 AM
    this is the error I get with the various ways i've tried
  • u

    user

    07/22/2021, 11:58 AM
    In what component are you using it?
  • a

    ambitious-knife-25690

    07/22/2021, 12:06 PM
    just a standard one, as i'm just creating externs i'm mostly copying example code from the page and running as is
  • u

    user

    07/22/2021, 12:07 PM
    Won't work in a standard one
  • u

    user

    07/22/2021, 12:07 PM
    Hooks only work in function components, not in class components
  • u

    user

    07/22/2021, 12:07 PM
    Might work in a
    @:jsxStatic
    component or a static function
  • a

    ambitious-knife-25690

    07/22/2021, 12:08 PM
    function components are the "newish" thing in rn i guess?
  • a

    ambitious-knife-25690

    07/22/2021, 12:08 PM
    I was unaware haxe had expression for it :o
  • u

    user

    07/22/2021, 12:10 PM
    They've been there for a looong while, possibly since the beginning
  • u

    user

    07/22/2021, 12:10 PM
    It's really just a
    static function MyComponent(props:MyProps):ReactFragment return jsx(...);
  • u

    user

    07/22/2021, 12:11 PM
    Issue is that js devs are too often oblivious to classic OOP and thus to classes, and the majority of react moved away from classes with hooks
  • a

    ambitious-knife-25690

    07/22/2021, 12:14 PM
    would i approach the extern creation differently as well due to this approach?
  • a

    ambitious-knife-25690

    07/22/2021, 12:15 PM
    I haven't seen any extern implementation for hook stuff in haxe so i'm in uncharted territory
  • a

    ambitious-knife-25690

    07/22/2021, 12:15 PM
    Copy code
    hx
    @:jsRequire('native-base', 'useToast()')
    extern class Toast extends ReactComponentOfProps<{
    > BoxProps,
    }> {
        function new();
        public static function show(input:ToastOpts):Void;
    }
  • a

    ambitious-knife-25690

    07/22/2021, 12:15 PM
    was what i was going with, i've had various iterations of this setup as i was trying to get it to work
1...606162...80Latest