hjertnes.blog

Different kinds of components

01.01.2018 01:00

All the components you have seen up this point, in this blog post series, have been of the regular React type; either based on Component or PureComponent. There are two others.

One of them are the “old-school” React.createClass, which is now deprecated. This is how React Component were defined before the “class” keyword in Javascript. It does more or less the same as if you use the class based component, only that the syntax is a little bit more “weird”.

The last kind is stateless functional components. They look like this:

https://gist.github.com/hjertnes/06b1d359c922b4a0d210069625cb5e50 ` The functional components are useful; and a highly controversial topic among some. The easiest way to understand them is to think of them as a component only being the render method. It will re-render every time the props change. And they don’t have any life cycle or state. I think they are useful for a number of reasons

  • ```text Fast to write ```
  • ```text Minimal overhead ```
  • ```text Easy to write a series of re-usable components ```
  • ```text You really consider if you component need state. If so, it would require a re-write. ```

    In rotation

    01.01.2018 01:00

    I haven’t written about what I use and carry in a long time now.

    The pens I carry change from week to week, but what I have with me today is my Pilot Vanishing Point, TWSBI Eco Stub and TWSBI Eco Broad. And I have my trusted Travelers Notebook with two lined refill, one Nock.co pocket sized notebook. And two Leuchtturm1917 A5 notebooks; one lined for writing and one dot grid for tasks and stuff.

    My current ink is Diamine Sargasso Sea.

    I’m mostly happy with my setup at the moment. There aren’t much I change, except for my ink every few months. But I do wish Leuchtturm1917 would expand the available colours available for their various notebooks. Because I would like to have different colours for the two notebooks I carry.

    #

    31.12.2017 01:00

    #

    31.12.2017 01:00

    #

    22.12.2017 01:00

    I thought I would share this little tip right before the holidays. When I assume those of you that believe in New Years Resolutions are planning them.

    When ever I know that I should do something about something that requires a lot of doing the same thing many times over. Like changing a lot of passwords or unsubscribing from newsletters etc, I often to this thing where I just add a repeating task for it. As a much more approachable and less procrastination prone way to do something about it.

    #

    21.12.2017 01:00

    I’ve been testing out the new “Sensei” driven auto-tune function in Lightroom CC for the last hour or so, and I got to say it’s pretty damn great.

    The auto-tuning feature of Lightroom have been a lot of “swing and a miss” over the years. When I started to use Lightroom in 2013 I thought it was usually making my pictures worse. Then a year later it got a lot better. It didn’t always improve the pictures, but some times it did.

    This new machine learning driven approach seems to be working great. All the pictures I have tested it on this far looks better, than they did. Not always by a lot, but still better.

    #

    20.12.2017 01:00

    The snow and ice is melting and I couldn’t be happier

    #

    20.12.2017 01:00

    This ThinkPad with Arch Linux, Spacemacs and XMonad is awesome. It feels like a digital typewriter. No distractions, just writing.

    #

    19.12.2017 01:00

    The latest version of Lightroom CC brings the file management features I was missing; it allows you to tell it to specify a location to store all of your originals that don’t count against the cache storage limit. In other words; it also brings a setting to store all smart previews locally. I think Lightroom CC is slowly turning into a much better version of Lightroom Classic.

    #

    16.12.2017 01:00

    I’ve put together this super simple shell script to make it easier to update all your Arch User Repository packages: update-aur-sh. The big if is that you need to check out all the AUR git repo’s to one folder, and just change the script to reflect where you place them.

    I kind of wish there were some better built in tools to manage AUR packages though.