line / create-liff-app

Start developing LIFF application with a simple CLI command.
https://developers.line.biz/en/docs/liff/
Apache License 2.0
63 stars 8 forks source link

Timing of LIFF.init #3

Closed r-hirakawa closed 2 years ago

r-hirakawa commented 2 years ago

In liff-playground, LIFF.init is called before DOM.render, but in the template of create-liff-app, LIFF.init is called in useEffect. Which is better?

liff-playground https://github.com/line/liff-playground/blob/master/src/index.tsx

create-liff-app template https://github.com/line/create-liff-app/blob/main/templates/react-ts/src/App.tsx

so99ynoodles commented 2 years ago

Hi, @r-hirakawa. Both are possible solutions. If you are calling liff.init in useEffect, make sure that calling it in the top-level component.

r-hirakawa commented 2 years ago

OK! I got it that this template is one of several cases in LIFF.init and I can modify it to suit my case.

Thank you for this good LIFF development tool. and thanks for your advice.