Closed precious-void closed 3 years ago
Hey @shtelzerartem,
will look into it as soon as possible 😄
Feel free to open a PR!
Hi @shtelzerartem,
sorry for the late update.
I've done a new branch feature/memo
wrapping the provider with React.memo.
Could you test it?
Thx
@elgorditosalsero I'm still experiencing this issue. Have made a pull request with steps to reproduce in description (#18), so you can check it. I don't think wrapping with react memo will help.
Hi @shtelzerartem
Sorry for the late answer.
Merged the PR. #19
Hey, pals, thanks for lib! I've been using your project to work with GTM and I ran into bugs like twice mounting or
cannot push to undefined
(https://github.com/elgorditosalsero/react-gtm-hook/issues/16 https://github.com/elgorditosalsero/react-gtm-hook/issues/13) So I was thinking, maybe there is a way to make it better. Firstly, because the init function is called twice sometimes it causes some troubles, so what if we pass the initial state directly into the GTM Provider Params?And secondly, why not separate sendGTMData (dispatchGTMEvent) hook and UseGTMHookProvider (GTMProvider)? So we would just initialize it only one time and after that, we would be able to set the data directly through the dispatchGTMEvent hook?
Would be really pleased to hear your thoughts about it!