Essays, poems, and personal reflections from the desk and drawer.

notes

Controlled and Uncontrolled Components

18 February 2023

A component with its own local state is often referred to as uncontrolled.

In contrast, a component is considered controlled when its key data and behavior are managed externally through props, rather than relying on its own local state. This approach allows the parent component to have full control over its behavior and data flow.

When designing a component, carefully consider which pieces of information should be controlled (managed via props) and which should remain uncontrolled (handled by the component’s state). However, keep in mind that you’re not locked into your initial decision—you can always refactor later as the needs of your application evolve.

References

React Doc, Freecodecamp

essay

Understanding JSX

4 February 2023

JSX is a XML-like syntax extension to ECMAScript (the acronym stands for JavaScript XML). Basically it just provides syntactic sugar...

essay

Codbix No.1

31 January 2023

Welcome to Issue #1 of The Codbix! This week: Learn In Public, Make free stuff, documentation, and Brag now.

essay

Card shortcode for Hugo

25 January 2023

Shortcodes are simple snippets inside your content files calling built-in or custom templates.

essay

React components

20 January 2023

Conceptually, components are like JavaScript functions. They accept arbitrary inputs and return React elements describing what should appear on the screen.

essay

Keep Going Through the Valley of Disappointment.

15 January 2023

When working towards these goals, we often expect linear progress. We work hard and expect to see results, which seems fair, right?

notes

Module in JS

12 January 2023

A module is just a file. One script is one module. As simple as that.

  • To make import/export work, browsers need <script type="module">.
  • Modules have several differences:
    • Deferred by default.
    • Async works on inline scripts.
    • To load external scripts from another origin (domain/protocol/port), CORS headers are needed.
    • Duplicate external scripts are ignored.
  • Modules have their own, local top-level scope and interchange functionality via import/export.
  • Modules always use strict.
  • Module code is executed only once. Exports are created once and shared between importers.

When we use modules, each module implements the functionality and exports it. Then we use import to directly import it where it’s needed. The browser loads and evaluates the scripts automatically.

In production, people often use bundlers such as Webpack to bundle modules together for performance and other reasons.

References

javascript info

essay

Why I am writing in the time of Reels?

1 January 2023

Is it worth it? Does anybody ever read this? Before this blog, these are the few questions...

notes

Oracle Timestamp

21 December 2022

The TIMESTAMP datatype is an extension on the DATE datatype. In addition to the datetime elements of the DATE datatype, the TIMESTAMP datatype holds fractions of a second to a precision between zero and nine decimal places, the default being six. There are also two variants called TIMESTAMP WITH TIME ZONE and TIMESTAMP WITH LOCAL TIME ZONE. As their names imply, these timestamps also store time zone offset information.

create table table_name (
    column_name number,
    column_name2 timestamp default systimestamp);

References

dba-oracle
dba-oracle 2