<Hi/>I am Max,Frontend developer

About:

I am based in Singapore, have a project you'd like to discuss?

My Experience:

Higher order component for ReasonReact

A higher order component is basically a reusable component which allows you to takes in another component and return a new component. To recap about higher component check our my older post here In ReasoML higher order function are called “Functors” which takes in a module type and returns a module type, functors are written […]

Read more

Better way to decode JSON in ReasonML/ReasonReact

Recently I was working on some reasonml/ReasonReact project which required to request data in JSON format from an API endpoint, well there are some BuckleScript decoders such https://github.com/glennsl/bs-json which is the more popular one,the way you decode is pretty easy:

you pass in the json and define the field in Json.Decode… at first it […]

Read more

fast piping in reasonml

fast piping allow you to transform your function code into more readable syntax, imaging you have human(person(age())) this is very inconvenience to see. with piping you can do it like this:

which is exactly the same as human(person(age())) there are 3 different pipes as I understand you can do like

or

whats different […]

Read more

Convert React project to ReasonReact project

Recently I converted one of my old React project while studying React from Udacity sometime back, Since I am reading ReasonML recently so I thought I might as well convert to ReasonML language or ReasonReact, you can find it here. MyRead ReasonReact

Read more

optional chaining in javascript

Imaging if you need to access deep level of property and you are not sure that if such properties exists deep down, you are doing something like

This is really difficult to read and understand sometime. there is something called optional chaining in javascript proposal which you can use if you include in babel-plugin-proposal-optional-chaining […]

Read more

ReasonML 101 notes

Reason 101: variable assignment with let keyword cannot is immutable, but you can set it to mutable by assign to ref() example JS:

in reason:

for string concat:

array in ReasonML is using [|”a”, “b”, “c”|] /* | = pipe symbol */

and

list is immutable. in list you can […]

Read more

Using react higher order component

When you start to work with lots of React components, and you realised alot of component patterns are the same, then you want to reuse these component patterns which is where Higher Order Component(HOC) kicks in. Think of HOC as higher order function: usually you write function in Javascript:

Higher order function basically is […]

Read more

React js 16.3

Recently Facebook has released the react 16.3 which bundled with a few awesome features including Context API and createRef(), I will talk abit about Context API since its quite hot topic. Context API its a feature that allows you to pass your data down to all child levels without passing props around like what you […]

Read more

Whats wrong with lambda internal server error

Lambda was a great service with great features, and serverless framework is even better, serverless simplified everything you do with AWS or other serverless providers. Was doing some fun with serverless framework where I am simply trying to output a response from some API to Lambda API gateway, and suddenly I got “Internal server error” […]

Read more

Udacity react nanodegree review

Recently I was graduated from react nanodegree with Udacity. The course was separated into 3 main course: 1) React Fundamentals 2) React & Redux 3) React Native Each course have their own assignment to complete, overall its about 4 or 5 months course, it only took me 1 month plus to complete 😉 since the […]

Read more

IntersectionObserver

IntersectionObserver is a very simple and powerful browser API, it really good to build such as lazy-load images, contents or whatever, the concept is really simple, it observer an element, when is visible and then you do something about it. One example, when this div is visible then load image. Outthought its not supported by […]

Read more

simple way to improve react applications performace

Before I start discussing some ways to improve the performance of react applicate, you should read the official doc from react site which already discussed about this topic. So in my own opinion few ways to improve the performance: 1) Use stateless/function component instead of writing class as component, using stateless component will eliminate “this” […]

Read more

server side react with next.js

After trying out next.js, totally lovely this tool, no reason not to use now with server side react render. One of the biggest benefit I felt is definitely the SEO part. As my screenshot below you can see that in source code which renders the contents, this is great for crawlers to quickly crawl your […]

Read more

Screenshot with google chrome without any plugin

Its new updates of Chrome 62 and its really easy to take screenshots with build in api, no longer require any plugins or extensions. Open up your chrome, usually I would use Chrome Canary which has latest versions. open up your console with

Read more

react 16 createPortal

React 16 introduced createPortal function which allows you to render elements outside react Dom, this become useful when you need to dynamically render some elements such as tooltip, modals… createPortal function can be used inside render method, and returns jsx as usual and where you want to render this element, as example below:

what […]

Read more

Easiest way to handling indexOf

Lets create a function that allow us to if string is available in array with this shortcode

using tilde operator will flip the bits in its operand. which is similar to

then use !! to convert this into boolen, this is easiest way to check indexOf and its more readable than …

Read more

Headless chrome puppeteer

Happen to try out this “Headless Chrome Node API” from chrome today, this npm allows you to write headless chrome directly which we used to do with phantomjs or other tools, it provides useful and easy APIs, I wrote a simple scripts allow me to check on CDC (ComfortDelGro Driving Centre) website to see if […]

Read more

Prevent table column resize/jump when you search table rows (React version)

Rendering with table in react is really easy, you just need to map through the result and return whatever should be shown as each TR, below is an example how you render table in react.

here comes a problem that I faced when working with table, lets say there is a search box somewhere […]

Read more

Reactive with react and meteor

If you been working with react and meteor, you will realised that both are reactive by nature of its framework/library, but when bridge them together, it does not work well in reactive way. fortunately Meteor team created a package called React Meteor Data.  To use React-Meteor-Data which is pretty easy, you just need to install […]

Read more

Working with meteor and react

Meteor, or MeteorJS, is a free and open-source isomorphic JavaScript web framework[3] written using Node.js. Meteor allows for rapid prototyping and produces cross-platform (Android, iOS, Web) code. It integrates with MongoDB and uses the Distributed Data Protocoland a publish–subscribe pattern to automatically propagate data changes to clients without requiring the developer to write any synchronization code. souce: https://en.wikipedia.org/wiki/Meteor_(web_framework) Basically meteor.js is a node.js framework that allow you to write web […]

Read more

React dealing with radios button

By default when you create radio multiple radios with same names, check either one will uncheck the rest.

Try out above codes. In jQuery we can get the value of the radio easily using:

In react we have use state to get the value of current selected radio:

Read more

React dealing with controlled component input forms

In most case react form will works normally until you wanted to set a value in the input and change while changes / start to input in something,

and you realised the value does not change no matter how hard you pressed, this is because of the controlled component: “In HTML, form elements such […]

Read more

react passing props to this.props.children

Previous article I mentioned about this.props.children and its feature, problem is this.props.children does not not provide a way to pass down the props, so we need a wrapper called React.cloneElement which allows you get this component and return a new component where you can also pass in the props like this:

by the way […]

Read more

Inline css in modern apps

While modern framework communities are push forward in using inline css, innovated by one of the react developer react-css-in-js. As Vjeux have presented in his deck the problems that they faced using css while they are working on react projects.

Read more

React double scrollbar component

While playing with react, I have built a react component which server as second scrollbar for your overflow divs. You are free to use the code that I added to github… https://github.com/maxlibin/react-doublescrollbar

Read more

React pass parameter to parent component or call parent function on ES6

sometime you will need to call parents function on react component, the problem in ES6 is that all functions are not bind with this, so you will need to do manually, below is a simple toggle function that you will call from Child component, notice that in order to call the parent’s method, you will […]

Read more

What is this.props.children

When I first saw this API, its about to tear my head apart, and now I will share with you about what I have learned on this.props.children the concept is easy: Imaging you have Parent component that call child component that works fine,

Read more

using SVG on your web

SVG Scalable Vector Graphics is an XML-based vector image format for two-dimensional graphics with support for interactivity and animation. Because of its scalable native, especially with very high graphical screens(example: retinal screen for Mac) these days, we need solutions for images or graphics to be display on these screens. Well these are many ways to […]

Read more