Chen Jian

My practice of fetching data for List/Detail components in React/Redux

The user experience it should have When you go to a detail page from the list page or with a direct URL, the detail page should show the up-to-date data When you go to the list page with a direct URL, the list page should show the up-to-date data When you RETURN to the list …

My practice of fetching data for List/Detail components in React/Redux Read More »

Load data from backend before rendering a React component – best practice

Where to put the data fetching code? componentWillMount() ? Not any more. It’s been deprecated. You have no choice but put it inside componentDidMount() , which is recomendded by React. However ther is a big issue. componentDidMount() is actually AFTER render(). It "works" because after componentDidMount() finishes its job and changes some state, render() will …

Load data from backend before rendering a React component – best practice Read More »

Date types for createdAt and updatedAt in MySQL

If you really want them work well, : 1. Make sure your mysql’s version is 5.6.5+ 2. The two columns exact data types must be createdAt timestamp not null DEFAULT CURRENT_TIMESTAMP, updatedAt timestamp null DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP

html5 localStorage pitfalls

It doesn’t disappear after window closed It doesn’t expire The old standard of it only allow string to be saved. New standard is not like so, but all mainstream browsers still use the old standard.