Testing latest React API: React Hook

in #react5 years ago

Testing out React (v16.8.0-alpha) Latest API

Screenshot 2019-01-12 at 1.02.27 AM.png

React Hooks

Take note that React Hooks are still in Alpha.

Sample code

React Hooks are available for functional component which are a "replacement" for react state in class component.

Using useState() you can create an array, where the first item in the array is the state, and the second item is a function to set the state.

Read more about React useState()

What makes hook really awesome is useEffect() function, because it replace 3 lifecycle hooks of react class component (componentDidMount, componentWillUnmount() & componentDidUpdate)

Read more about React useEffect()

Ultimately, with React Hooks, you are able to write even less codes and in a more functional approach.

Live version

Live version of the site is at https://superoo7.github.io/react-16.8.0-alpha/

The source code is on GitHub, which includes another few latest API (React.Suspense, Context API and Hooks)

Sort:  

You’ve been upvoted by TeamMalaysia Community :-

To support the growth of TeamMalaysia Follow our upvotes by using steemauto.com and follow trail of @myach

Vote TeamMalaysia witness bitrocker2020 using this link vote for witness

Hi, @superoo7!

You just got a 0.9% upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in here to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.

Task Request. We Modified Our Task Request To Add Core Features & 'Communities' To Ulogs.org, Simplifying The 1.5 Task Drastically. + (500 Steem Is Completed In 7 days/550 Steem For 5 Days)

The task has been drastically simplified and the first task is partially done. Ulogs is front-end only and a fork of busy. It uses React JS. This tasks have been delayed. It has been more than a month already. Please consider helping me or please pass it on, to anyone who can help me. The time allotment for both tasks is 7 days.

https://steemit.com/utopian-io/@surpassinggoogle/task-request-we-modified-our-task-request-to-add-core-features-and-communities-to-ulogs-org-simplifying-the-1-5-task-drastically

Congratulations @superoo7! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You made more than 13000 upvotes. Your next target is to reach 14000 upvotes.

Click here to view your Board
If you no longer want to receive notifications, reply to this comment with the word STOP

Support SteemitBoard's project! Vote for its witness and get one more award!

Coin Marketplace

STEEM 0.29
TRX 0.12
JST 0.035
BTC 65090.19
ETH 3379.11
USDT 1.00
SBD 4.55