hjertnes.blog

Component Design

17.01.2018 01:00

How you design your components will affect a large number of different things, everything from performance to how maintainable your code is. It will never be perfect, and don’t try to get it right form the start. It will just kill your productivity.

Use PureComponent instead of Component as your base class, it will limit the number of re-renders and therefore improve your apps general performance. And learn how to develop using many small components instead of fewer large ones, because then the browser will spend much less resources on rendering. If everything is in one large render function (aka a component) then your browser will run through all of it every time something change, but it will only have to run through a smaller part of it if you have divided it into many smaller components.

Smaller components are also usually easier to make re-usable.

#

16.01.2018 01:00

Top 5 BuJo Ideas in 2017 - Bullet Journal 🤦‍♂️ Write Bullet Journal like every other self respecting adult would.

#

16.01.2018 01:00

“fucking snow…”

#

16.01.2018 01:00

#

16.01.2018 01:00

Testing out feedbin, it feels like cheating

#

16.01.2018 01:00

Every time I use the portrait mode on my iPhone I end up reaching for my X-Pro 2

#

16.01.2018 01:00

Bye bye productivity – the next 12 hours. I decided to do a fresh install on my MacBook Pro.

Structure

16.01.2018 01:00

A few words on structuring your react app. Don’t think too much about structure, keep it as flat as possible, for as long as possible. Use redux to make your state sane, and use higher order components to limit code duplication. But keep one component per file.

I’m a fan of structuring stuff when it hurts to not do it. Then I would look into making modules out of the stuff that is just used one place.

Let’s say you have a route where you add and edit blog posts; have all the stuff that is just used there in a folder, and then have the main component you use in the Editor in the moduleFolderName/index.js.

React won’t solve any of your problems with sturcturing your code base, but neither will anything else.

But one thing that is more imporant than most is to use eslint. Base it on a sane set of configurations like the airbnb one and modify it to fit your requirements. Linting is a good way to keep your codebase sane and a good way to filter out some stuff.

It won’t replace automated testing or proptypes but is a important addtion.

One last thing I personally think is important to think about when you have a large app, try move everything that is used multiple places to a single place. And then try to make sure that each module in your component structure never import outside of it’s own folder, except for state and common. I also always start with the following structure: state(everything related to redux), utils(javascript code) and components(react code).

#

15.01.2018 01:00

It’s my first Micro Monday participation. If you don’t already, start following [@eli\](https://micro.blog/eli) her links are the best!

More retractable fountain pens

15.01.2018 01:00

So, if you want a good retractable fountain pen, you have one good option. And I have only seen one other option, which isn’t that good to be honest.

On one side you have the Pilot Vanishing Point and on the other you have the Lamy Dialog 3.

I have a VP and I love it, even though it has some constraints. The short version is that it is a special pen, where Pilot have made many hard choices in order to get a pen that is as good as it is. But that means that it won’t be a good fit for many people. The biggest problem with it is that the clip is kind of annoying for some people, doesn’t hold enough ink, and that it is a pain in the ass to fill when you ink bottle runs low.

My impression when I was going to get a retractable pen, and spent some(a lot) of time researching is that the Dialog isn’t that great. I might get one at some point, but not now.

Here is the thing: we need more retractable fountain pens. To get some fresh blood and some competition in this market where Pilot and their Vanishing Point dominates. I get the engineering problems with making it. But I want more competition here. Because many people cannot use the only good retractable fountain pen available, because of the clip.

It would be really awesome if someone started to sell the mechanism, and then as a result a lot of different pen designs based on it.