
“I think your website contain a virus”, said my client. wHaT!!! then I ask further and they said because it showing “alert” like website which has virus. LOL 😂 I thought it was real virus.
it’s not a big deal but I don’t want to become their bias which lead their habit to feel ok clicking the alert from suspicious website. As developer,
alert
, prompt
, and confirm
always become our default supafast way to display message, confirmation, and single input. even in iPhone it will show the native alert and I think it looks beautiful. it’s what I thought since it’s been a long time since I open suspicious website. (lk21, ilegal anime etc). if that’s what my client feel then let’s fix it.Next step is modify alert on my website. I goes shopping on npm website then I found “Sweetalert2”, The sweet embodiment of alert 💅. since I develop react app, my article about react x jquery ever been mocked when implement native jsdom such window, document function in my site. Then come this sweet hearth which can show alert anywhere without state, ref, and use use use….. at least it nativeness become seamless. 😆
Nowadays it’s not about “LOOK MY FANCY COMPLICATED CODE” but “IS AI CAN UNDERSTAND IT?” fr. we must start to give a concern about the DX such as function naming. so I wonder if we want to keep our DX score high with implementing Sweetalert then I should wrap this sweety to looks like our native alert. Here we go :
with simple wrapper like this we can use Sweetalert with native alert DX.
Next Journey I will show how to build anywhere alert like sweetalert using our beloved state management, Zustand. see you next.