laksh
laksh
SSolidJS
Created by laksh on 7/9/2024 in #support
web-vitals integration
I am coming from a POV where src/index.jsx is the root file which wont be triggered again even if the user navigates to other components/routes. So is it good to keep it outside onMount() (the 2nd approach.) Also ,the react docs has an inbuilt fn called reportWebVitals which is recommended to be invoked outside onMount in the react docs. Because of the above POV, I wanted to know what difference it makes in 1st vs 2nd approach?
29 replies
SSolidJS
Created by laksh on 7/9/2024 in #support
web-vitals integration
@Eagerestwolf
29 replies
SSolidJS
Created by laksh on 7/9/2024 in #support
web-vitals integration
src/index.jsx function MyApp(){
onMount(()=>{ // 1. initWebVitals(); }); // 2. initWebVitals(); return ( <p>MyApp</> ); } Basically which is the right place to call initWebVitals 1 or 2?
29 replies
SSolidJS
Created by laksh on 7/9/2024 in #support
web-vitals integration
@Alex Lohr Please add your POV here
29 replies
SSolidJS
Created by laksh on 7/9/2024 in #support
web-vitals integration
@Eagerestwolf No I am not trying to log I am just sending it to api from client side. My application is client side Basically Logger is a class which has a logic of queuing up the objects and sending it to an api. Forget about the Logger class. I want to know which is the right place for invoking initWebVitals fn. Should it be inside onMount of src/index.jsx or outside of onMount in src/index.jsx...only this is my ask.
29 replies
SSolidJS
Created by laksh on 7/9/2024 in #support
web-vitals integration
@Reve are you asking or telling? 😄
29 replies
SSolidJS
Created by laksh on 7/9/2024 in #support
web-vitals integration
@TaQuanMinhLong I can see some difference in result...but not sure which is the correct way to implement.
29 replies
SSolidJS
Created by laksh on 7/9/2024 in #support
web-vitals integration
haha @Reve Can you pleae tell the apprach which should be implemented
29 replies
SSolidJS
Created by laksh on 7/9/2024 in #support
web-vitals integration
outside onMount or inside onMount?
29 replies
SSolidJS
Created by laksh on 7/9/2024 in #support
web-vitals integration
@fabiospampinato
29 replies
SSolidJS
Created by laksh on 7/9/2024 in #support
web-vitals integration
@davedbase @Reve Please comment here
29 replies
SSolidJS
Created by laksh on 7/9/2024 in #support
web-vitals integration
@TaQuanMinhLong
29 replies
SSolidJS
Created by laksh on 7/9/2024 in #support
web-vitals integration
@Ryan
29 replies
SSolidJS
Created by laksh on 7/9/2024 in #support
web-vitals integration
To integreate this library in solidjs I have a function called initWebVitals() which looks like this. Now my question is where should this function be called inside src/index.jsx . Should this be called in onMount of index.jsx or outside of onMount in index.jsx? performance.js import { onCLS, onLCP, onTTFB, onFCP, onINP } from 'web-vitals'; import Logger, { LOG_LEVELS } from './logger'; function sendToAnalytics(metric) { const immediate = metric.name === 'LCP' || metric.name === 'CLS'; Logger.info({ ...metric, pathname: window.location.pathname }, true, immediate); } export function initWebVitals() { onCLS(sendToAnalytics); onLCP(sendToAnalytics); onTTFB(sendToAnalytics); onFCP(sendToAnalytics); onINP(sendToAnalytics); }
29 replies
SSolidJS
Created by laksh on 7/1/2024 in #support
I have a use case for createResource vs normal async await api call.
Can we use createResource outside a component?
18 replies
SSolidJS
Created by laksh on 7/1/2024 in #support
I have a use case for createResource vs normal async await api call.
can u please tell me?
18 replies
SSolidJS
Created by laksh on 7/1/2024 in #support
I have a use case for createResource vs normal async await api call.
in which version it was introduced? i am using "@solidjs/router": "0.8.2",
18 replies
SSolidJS
Created by laksh on 7/1/2024 in #support
I have a use case for createResource vs normal async await api call.
in solidjs
18 replies
SSolidJS
Created by laksh on 7/1/2024 in #support
I have a use case for createResource vs normal async await api call.
from where do we import createAsync?
18 replies
SSolidJS
Created by laksh on 7/1/2024 in #support
I have a use case for createResource vs normal async await api call.
I want to call a simple api function on button press to get the otp...is calling the getOtp in a normal async await fine or calling it with something like createResource should be the recommended approach?
18 replies