Elwin's Blog

an activist who likes to think

Tag: web

front cover

maintainable code for google tag manager with Universal Analytics

Posted on

TL;DR Use data attribute starting with data-gtag- on the element you want to watch for triggering event, if that event is on a component that will be used in multiple places, and you only want to watch some of them, choose to pass data-gtag as the class name on the component you want to watch, to collect complicated data in an object or array type, use this instead:

Continue reading
front cover

Use Strapi & Next.js to bootstrap your blog site with high volume on free tier

Posted on

As a front end Web developer who likes to code, I think it's reasonable to start my own blog to document what I learned on web development, and there are multiple options to choose from when building a blog site, they are all viable options, I'll start from the one require no coding skills, all the way up to the one that needs the most coding skill :

Continue reading
front cover

Common mistakes regarding React rendering behavior

Posted on

As a react developer who builds a web app that can handle more than 50 WebSocket events that will be merged into state per second while keeping it 60 FPS, I spend a lot of times on tuning the performance on my web apps, and recently, when I was doing code review on a junior developer, I noticed some mistakes that will harm the performance of the web apps

Continue reading
front cover

The Fundamental Of Coding Interview Question part 4 (Javascript)

Posted on

System Design and Scalability

this section is more related to the back-end than the front-end, but it's good to know from a broader view:

  • Communication: it's more important in the system design than dealing with a specific coding algorithm question. because most of the time, a lot of details won't be covered in the problem description, so the candidate should ...
Continue reading
front cover

Avoid triggering multiple times on a useEffect when changing multiple state

Posted on

For example:

You have a useEffect that watches the event_id and the date_range, they are separate states from useState.

when one of them changes, it will re-query a list of events.

The user can change the event_id from a list of events, the user can also change the date_range by using the date picker.

Somehow, you got a new request that when an active event_id is changed, the...

Continue reading
front cover

OWASP Top 10 security risk on 2021 for front-end

Posted on

The complete list of the description and prevention of each security vulnerability can be found here.

Now let's look at each one more closely:

A01:Broken Access Control

Common ones include the following:

CWE-200: Exposure of Sensitive Information to an Unauthorized Actor
CWE-201: Insertion of Sensitive Information Into Sent Data

Continue reading
front cover

The modern static analysis tools for Javascript

Posted on

I've done on setting up a boilerplate project with 4 statistic analysis tools for React framework(using create-react-app), you can find it out here.

The tools included in the project are:

  1. Eslint (mainly used to check code errors)
  2. Prettier (a code formatter with little configuration rules )
  3. Stylelint (checking on style...
Continue reading
front cover

The modern approach on responsive design

Posted on

Internationalization:

Logical properties

Instead of writing margin-left, using margin-inline-start to refers to the margin on the left side of a content box in a left-to-right language, and the margin on the right side of a content box in a right-to-left language.

There are more logical properties that can be

Continue reading