Home » react » Page 2

One of the more common ways to share functionality between components are so-called higher order component. Where the idea is that you have a higher order function that returns a component. Basically, anytime you have a function that takes components as an argument and returns another component, that’s a augmented version of the component you […]

Read More

Good morning Kiwi. So far in this video series we’ve been building components using the Linux or the functional programming philosophy. You build a component that does one thing and does it really well then you compose multiple small components into big chunks that do parts of your app and things like that. But we […]

Read More

We’ve used component lifecycle methods before, but we haven’t really talked about what they are or how they work. You can kind of think of them as callbacks that react uses to tell you about the different phases that your component goes through before it’s rendered to the page. There are three distinct operations that […]

Read More

React refs are a feature of React that you should never use until you absolutely have to. They give you access directly to the DOM, which is something you’re not supposed to really do in React. You see, refs are what you consider an escape hatch. In React you’re always supposed to render new things […]

Read More

The key prop is something react will yell at you about if you render a list of elements in loop and don’t give each of them a unique key. I need these keys to be able to tell elements apart so I can know which on is which and if you order something or delete […]

Read More

Styled components are my favorite approach to styling react components because they combine the best of CSS and CSS in JS. The way styled components work is that you have a styled … I guess it’s a dictionary with a bunch of predefined basic components, divs, H1s, and so on. You say styled.div and use […]

Read More

CSS modules are not my favorite, but they’re pretty much the best option you have if you already have a bunch of existing CSS files, and you want to reuse them in your react project. They work by letting you import a bunch of CSS files and turn them into JavaScript objects that you then […]

Read More

The easiest way to style your components is using the style prop, where you get to passing a java script object that describes how you want your styling to look, and React then handles the rest, and passes that into the style prop of your dom attribute, right Kiwi? While it’s the easiest, I would […]

Read More

Let’s talk about styling. So far we’ve been using the style prop to kind of hack together our colors changing and stuff like that when we were focusing mostly on the logic of our components, but there are better ways to do that stuff. There are three basic approaches to styling react components, and they […]

Read More

We talked about unidirectional data-flows and how connecting multiple components means you have to hoist common state and then connect with props and callbacks. You see, when you’re deeply nesting your components and they all have to know about some common state, it means you have to go props, props, props … We have this […]

Read More