<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>React on Yosgi Blog</title><link>https://siqi-liu.com/en/tags/react/</link><description>Recent content in React on Yosgi Blog</description><generator>Hugo</generator><language>en</language><lastBuildDate>Fri, 12 Jun 2026 04:28:41 +0000</lastBuildDate><atom:link href="https://siqi-liu.com/en/tags/react/index.xml" rel="self" type="application/rss+xml"/><item><title>Understanding React Hooks</title><link>https://siqi-liu.com/en/post/understanding-react-hooks/</link><pubDate>Thu, 25 Feb 2021 00:00:00 +0000</pubDate><guid>https://siqi-liu.com/en/post/understanding-react-hooks/</guid><description>Understanding React Hooks Release Date: February 25, 2021 Understanding React Hooks Those who have used the old version of react should know that react’s class component has state to manage the internal state, as shown in the following example code class Clock extends React.Component { constructor(props) { super(props); this.state = {date: new Date()}; } render() { return ( &lt;div&gt; &lt;h1&gt;Hello, world!&lt;/h1&gt; &lt;h2&gt;It is {this.state.date.toLocaleTimeString()}.&lt;/h2&gt; &lt;/div&gt; ); } }Function components do not have their own state, as shown in the following example code function Clock() { return ( &lt;div&gt; &lt;h1&gt;Hello, world!&lt;/h1&gt; &lt;h2&gt;It is {new Date().toLocaleTimeString()}.&lt;/h2&gt; &lt;/div&gt; ) }If I want to use a function component and want to have manual control over the date, I have to modify the component using props as follows, which transfers control to the parent component:</description></item></channel></rss>