Tagreact

Converting A Stateful React Component To Function With Hooks

C

For a long time if we wanted to create a stateful component in React we needed to create a class and inherit it from React.Component. But dealing with classes can be a frustrating experience and contradicts the functional nature of React itself. I wrote a rant article on that before. With the release of React v16.7.0-alpha, React team proposed a way to create stateful components based on...

Setting up Webpack 4 and Babel 7 for React Step By Step

S

In this article, I’m going to quickly show how to start a new React app with Webpack 4 and Babel 7. This is going to be a no-bullshit step-by-step guide. Spoiler: it’s very easy. Create a new directory with mkdir test-react-app && cd test-react-app Init the package.json with command npm init -y (-y flag means don’t ask just create it) Install Webpack npm install webpack...

React without “this”

R

For some weird reason, even though React is rather functional in its philosophy (compare higher-order components and higher-order functions), they decided to use classes for components with a state. I want to stress it — the heavy classes usage in React is a mere API choice. There is nothing about React or its core values that couldn’t be represented with pure functions. But classes add up...

Recent Posts

Categories

Meta