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

    ambitious-knife-25690

    07/22/2021, 12:16 PM
    it seems like it's not the extern definition that is wrong here, but more the way to use it if i'm understanding correctly?
  • u

    user

    07/22/2021, 12:21 PM
    Why not just something like that? hooks are not components, just functions
    Copy code
    @:jsRequire('native-base')
    extern class Toast {
      public static function useToast(...):Foo;
    }
  • u

    user

    07/22/2021, 12:22 PM
    Seemed to work fine anyway since you got to the error, so you managed to call the hook
  • a

    ambitious-knife-25690

    07/22/2021, 12:45 PM
    this also gives the invalid hook call error
  • a

    ambitious-knife-25690

    07/22/2021, 12:45 PM
    but I get one less error than i did before
  • a

    ambitious-knife-25690

    07/22/2021, 12:45 PM
    > Why not just something like that? hooks are not components, just functions My Ignorance 😅
  • a

    ambitious-knife-25690

    07/22/2021, 12:46 PM
    use case is the same as the first example on the Toast page
  • u

    user

    07/22/2021, 1:17 PM
    Yeah because it's not about the extern at all
  • u

    user

    07/22/2021, 1:18 PM
    You can't use the hook inside a ReactComponent
  • a

    ambitious-knife-25690

    07/22/2021, 1:44 PM
    woah
  • a

    ambitious-knife-25690

    07/22/2021, 1:44 PM
    this is kind of trippy to use
  • a

    ambitious-knife-25690

    07/22/2021, 1:45 PM
    haxe having functional methods makes this convenient to use then, neat
  • a

    ambitious-knife-25690

    07/22/2021, 1:45 PM
    Way to use it:
  • a

    ambitious-knife-25690

    07/22/2021, 1:45 PM
    then just put
    <Example />
    where you want to use it
  • u

    user

    07/22/2021, 1:48 PM
    Yeah, that's static components
  • a

    ambitious-knife-25690

    07/22/2021, 1:48 PM
    it feels sinful lol
  • u

    user

    07/22/2021, 1:48 PM
    You can read more there https://github.com/kLabz/haxe-react/blob/next/doc/static-components.md
  • u

    user

    07/22/2021, 1:48 PM
    (don't remember if I added that to original haxe-react repo too... °°)
  • u

    user

    07/22/2021, 1:49 PM
    There are some useful things on this doc/ folder, and I should try to find time to add more
  • a

    ambitious-knife-25690

    07/22/2021, 1:49 PM
    ahh, wasn't aware, i usually just default to the readme as the indexing for docs
  • u

    user

    07/22/2021, 1:50 PM
    Yeah but I didn't want to modify the readme too much initially since this fork was supposed to be temporary :x
  • a

    ambitious-knife-25690

    07/22/2021, 1:50 PM
    this temp fork is the main repo for all my react projects 😆
  • u

    user

    07/22/2021, 1:51 PM
    Yeah and is also used as base for coconut's react interop x)
  • a

    ambitious-knife-25690

    07/22/2021, 1:51 PM
    i'll revisit the docs, at some point, i'd like to try to upgrade react's externs to allow the newer age stuff
  • u

    user

    07/22/2021, 1:51 PM
    And also for react-native I think
  • u

    user

    07/22/2021, 1:51 PM
    Yeahhh I don't want to maintain hooks, but nothing prevents adding a
    react-hooks
    lib that does it
  • a

    ambitious-knife-25690

    07/22/2021, 1:52 PM
    any particular reason why not?
  • u

    user

    07/22/2021, 1:52 PM
    I got a branch for SSR somewhere, gotta go back to the project using it, fine-tune it and merge
  • u

    user

    07/22/2021, 1:52 PM
    Well, I'll never use them so that doesn't help with maintaining it, for starter x)
  • u

    user

    07/22/2021, 1:52 PM
    It doesn't work with class components, and I only use class components
1...616263...80Latest