<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: monsterooo</title>
    <description>The latest articles on DEV Community by monsterooo (@monsterooo).</description>
    <link>https://dev.to/monsterooo</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F54842%2F915f28dd-ce7d-4dd5-9035-82a502d9e95c.jpeg</url>
      <title>DEV Community: monsterooo</title>
      <link>https://dev.to/monsterooo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/monsterooo"/>
    <language>en</language>
    <item>
      <title>Remove a Background in PhotoCraft Without Deleting a Single Pixel</title>
      <dc:creator>monsterooo</dc:creator>
      <pubDate>Mon, 19 Oct 2026 07:49:22 +0000</pubDate>
      <link>https://dev.to/monsterooo/remove-a-background-in-photocraft-without-deleting-a-single-pixel-3644</link>
      <guid>https://dev.to/monsterooo/remove-a-background-in-photocraft-without-deleting-a-single-pixel-3644</guid>
      <description>&lt;p&gt;PhotoCraft is the free, open-source image editor from the ArtCraft team that copies Photoshop's layout: layers, masks, adjustment layers and PSD support, written in Rust. One of the first things people try in it is a background removal. It works well, but two things trip up new users: &lt;strong&gt;the button doesn't show up at all on some layers&lt;/strong&gt;, and the result isn't really an "erase" step.&lt;/p&gt;

&lt;p&gt;This walkthrough covers the whole job, from opening the photo to exporting a PNG with transparency. It was written against PhotoCraft 0.8.2, where the command moved from the Layer menu to the Properties panel. Newer releases may move it again, so check the release notes if your menus look different.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Disclosure: I maintain an unofficial guide site for PhotoCraft. I'm not part of the PhotoCraft or ArtCraft team.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What "Remove Background" actually does
&lt;/h2&gt;

&lt;p&gt;It doesn't delete anything. PhotoCraft finds the subject, refines the edge, and adds &lt;strong&gt;one layer mask&lt;/strong&gt; to the layer. The subject stays visible, the rest is hidden, and every original pixel is still on the layer.&lt;/p&gt;

&lt;p&gt;That matters because:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;you can paint the mask afterwards to fix an edge,&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Undo&lt;/strong&gt; takes the mask off and &lt;strong&gt;Redo&lt;/strong&gt; puts it back (the history step is called &lt;em&gt;Remove Background&lt;/em&gt;),&lt;/li&gt;
&lt;li&gt;clicking the button a second time &lt;strong&gt;replaces&lt;/strong&gt; the mask instead of stacking a second one.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It also runs on your machine. It uses the same on-device subject detection as &lt;em&gt;Select Subject&lt;/em&gt;: no account, no upload, no cloud step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 0: Open the photo (and work on a copy)
&lt;/h2&gt;

&lt;p&gt;Use &lt;strong&gt;File › Open&lt;/strong&gt;, the recent-files list, or drop the file on the window. JPEG, PNG, PSD/PSB and several camera raw formats (DNG, CR2, NEF, ARW, RAF) open. CR3 isn't on the list yet.&lt;/p&gt;

&lt;p&gt;PhotoCraft is still early alpha, and its developers say so. If the source is an important PSD, open a copy, not the original.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Unlock the layer (this is why the button is "missing")
&lt;/h2&gt;

&lt;p&gt;In 0.8.2 the &lt;strong&gt;Quick Actions&lt;/strong&gt; section of the Properties panel stays empty on a locked layer. A freshly opened photo is usually a locked &lt;strong&gt;Background&lt;/strong&gt; layer, and a Background layer can't hold a mask at all.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Background layer:&lt;/strong&gt; double-click it in the Layers panel, or choose &lt;strong&gt;Layer › New › Layer from Background&lt;/strong&gt;. PhotoCraft renames it &lt;em&gt;Layer 0&lt;/em&gt; and clears the locks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Normal pixel layer:&lt;/strong&gt; in the Lock row, turn off &lt;strong&gt;Lock all&lt;/strong&gt; and &lt;strong&gt;Lock image pixels&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Type, shape, smart object, group, fill and adjustment layers never show these buttons. Rasterize or pick a pixel layer first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Click Remove Background
&lt;/h2&gt;

&lt;p&gt;Open &lt;strong&gt;Window › Properties&lt;/strong&gt; and scroll to &lt;strong&gt;Quick Actions&lt;/strong&gt;. You'll see two buttons: &lt;strong&gt;Select Subject&lt;/strong&gt; and &lt;strong&gt;Remove Background&lt;/strong&gt;. Click &lt;strong&gt;Remove Background&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The command only looks at the &lt;strong&gt;selected layer&lt;/strong&gt;. It doesn't sample the layers underneath. If you have an empty layer selected above your photo, nothing happens. The same goes for a layer with no clear subject: the document stays unchanged.&lt;/p&gt;

&lt;p&gt;Any active selection is cleared when the mask is added.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Check and fix the edge
&lt;/h2&gt;

&lt;p&gt;A checkerboard now shows where the background is hidden, and a white thumbnail next to the layer is the mask.&lt;/p&gt;

&lt;p&gt;Zoom to &lt;strong&gt;100%&lt;/strong&gt; and look at hair, fur and other fine edges. That's where automatic cut-outs fail, in PhotoCraft and everywhere else. The project's own roadmap still calls the cut-out workflow partial, and &lt;em&gt;Select and Mask&lt;/em&gt; is a simpler dialog than Photoshop's full workspace.&lt;/p&gt;

&lt;p&gt;To fix an edge, click the mask thumbnail so you're painting on the mask, then:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;paint &lt;strong&gt;black&lt;/strong&gt; to hide more,&lt;/li&gt;
&lt;li&gt;paint &lt;strong&gt;white&lt;/strong&gt; to bring pixels back,&lt;/li&gt;
&lt;li&gt;use &lt;strong&gt;grey&lt;/strong&gt; for partial transparency (soft hair edges).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a small, even correction, the selection commands (feather, expand, contract, smooth) are quicker than painting.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4 (optional): Mask an adjustment instead of the photo
&lt;/h2&gt;

&lt;p&gt;The same mask idea works for color changes without touching the photo. Make a selection (for example &lt;em&gt;Select Subject&lt;/em&gt;), add an adjustment layer such as &lt;strong&gt;Hue/Saturation&lt;/strong&gt;, and the selection becomes that adjustment's mask. Only the masked area changes, and the photo's pixels stay as they were. Want the subject in color and the background in black and white? Invert the selection and desaturate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Export a transparent PNG and keep an editable copy
&lt;/h2&gt;

&lt;p&gt;The file you hand to someone and the file you keep for editing aren't the same:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;You want…&lt;/th&gt;
&lt;th&gt;Use&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;To keep editing in PhotoCraft later&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Save As › .pcraft&lt;/strong&gt;. It's PhotoCraft's lossless native format, with incremental save and crash recovery&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Someone else to open the layers in another app&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;PSD&lt;/strong&gt; (fidelity is still improving, so test it in the app that has to open it)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A finished cut-out with transparency&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Export As › PNG&lt;/strong&gt;, which shows a preview and a file-size estimate. &lt;strong&gt;Quick Export&lt;/strong&gt; writes a PNG in one step&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Export flattens what you see, so the hidden background becomes real transparency in the PNG while your .pcraft keeps the mask editable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick troubleshooting
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No Remove Background button:&lt;/strong&gt; the layer is locked, or it's a Background, type, shape, group or adjustment layer. Unlock it or pick the pixel layer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nothing happened:&lt;/strong&gt; the selected layer has no subject, or you selected an empty layer above the photo.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"Where did Layer › Remove Background go?"&lt;/strong&gt; The v0.5.0 notes put it in the Layer menu. In 0.8.2 it's only the Quick Actions button.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bad hair edge:&lt;/strong&gt; paint the mask in grey/white at 100% zoom, or feather the selection before running it again.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Getting PhotoCraft
&lt;/h2&gt;

&lt;p&gt;Download it only from the official sources: the &lt;a href="https://github.com/storytold/photocraft/releases" rel="noopener noreferrer"&gt;GitHub releases&lt;/a&gt; or the PhotoCraft page on getartcraft.com. Builds exist for Windows, macOS, Linux, FreeBSD and the web.&lt;/p&gt;

&lt;p&gt;I keep a longer, version-checked version of this lesson, plus layers, masks and adjustment-layer lessons, in the &lt;a href="https://photocraftguide.com/guide/remove-background" rel="noopener noreferrer"&gt;PhotoCraft Guide editing lessons&lt;/a&gt;, along with install steps for each OS. If something in this post stops matching your version, check there first.&lt;/p&gt;

</description>
      <category>photoshop</category>
      <category>opensource</category>
      <category>design</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>I sit for 10 hours, so I built a 20-minute workout that starts before I can talk myself out of it</title>
      <dc:creator>monsterooo</dc:creator>
      <pubDate>Thu, 08 Oct 2026 14:37:37 +0000</pubDate>
      <link>https://dev.to/monsterooo/i-sit-for-10-hours-so-i-built-a-20-minute-workout-that-starts-before-i-can-talk-myself-out-of-it-dl0</link>
      <guid>https://dev.to/monsterooo/i-sit-for-10-hours-so-i-built-a-20-minute-workout-that-starts-before-i-can-talk-myself-out-of-it-dl0</guid>
      <description>&lt;p&gt;Last March I closed a PR, stood up, and my neck made a noise I did not like. Not an injury. Just the sound of someone who had been folded into a chair since 9am and called it a workday.&lt;/p&gt;

&lt;p&gt;I already knew the advice. Move more. Lift something. Don't only stretch your hip flexors by accident when you reach for the charger. What I did not have was a plan that survived a normal Tuesday. Gym memberships die in week three. YouTube workouts die when the intro is longer than the set. The thing that kept killing it was the 10 minutes of deciding what to do.&lt;/p&gt;

&lt;p&gt;So I built the thing I kept wishing existed: &lt;a href="https://homefitroutine.com/" rel="noopener noreferrer"&gt;HomeFit Routine&lt;/a&gt;. Free, no account, pick a goal and a length, press start. The rest of this post is the part I actually care about, which is why 20 minutes is enough and how to not waste them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Favbhpr5rl3o1oprtradw.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Favbhpr5rl3o1oprtradw.jpg" alt="Bodyweight work in a living room, which is the whole gym most of us have" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Sitting is the bug, not "not being a gym person"
&lt;/h2&gt;

&lt;p&gt;Programmers do not have a motivation problem so much as a posture problem that lasts eight to twelve hours. The chair is the default state. Movement is the exception you have to schedule.&lt;/p&gt;

&lt;p&gt;That matters for boring medical reasons and for reasons you can feel by Thursday.&lt;/p&gt;

&lt;p&gt;WHO's baseline is about 150 minutes a week of moderate work, or 75 of harder work, plus two days of something that loads your muscles. That is not a six-day split. It is three or four short sessions. A workplace study people still cite (University of Bristol, on days people actually exercised) found better concentration and motivation on those days. I would not bet the company on one study. I would bet on the pattern: sleep is less garbage, the 3pm fog shows up later, and your lower back stops filing tickets.&lt;/p&gt;

&lt;p&gt;Strength work does a different job than a walk. Squats, hinges, pushes, and pulls are what keep a desk job from slowly deleting your legs and upper back. Cardio is what keeps the afternoon from feeling like a low battery warning. You want both. You do not need a program that looks like a bodybuilding forum from 2009.&lt;/p&gt;

&lt;h2&gt;
  
  
  Efficient means fewer decisions, not more suffering
&lt;/h2&gt;

&lt;p&gt;Most home workouts fail in the setup, not the last rep.&lt;/p&gt;

&lt;p&gt;A session that fits a shipping week has four constraints:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It starts in under a minute. If you are shopping for a video, you are already done.&lt;/li&gt;
&lt;li&gt;It is 15 to 30 minutes. Ten is a floor, not a personality. Forty-five is for days the build is already green.&lt;/li&gt;
&lt;li&gt;Big moves first. Squat, hinge, push, pull, carry or a plank. Curls are optional. A squat is not.&lt;/li&gt;
&lt;li&gt;You leave one rep in the tank and make next week slightly harder. That is the whole progression model. More reps, a slower lower, a harder variation, or a dumbbell if you own one.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Rest is part of the work. On a strength day, rushing the rest just makes the sets sloppy. On a short conditioning day, short rests are the point. Mixing those up is how people do 40 minutes and feel like they did nothing.&lt;/p&gt;

&lt;p&gt;Apartment rule, learned the hard way: jumping is optional. A neighbor does not care about your zone 2. Step jacks and a quiet squat pattern still count.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F49nsesrwdfjhb201p4wp.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F49nsesrwdfjhb201p4wp.jpg" alt="A pair of dumbbells covers most of what a home setup needs" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I actually do
&lt;/h2&gt;

&lt;p&gt;Three days a week, usually after the first deep work block, not after dinner when the excuse factory is fully staffed.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Two days: full body, 20 minutes, no equipment or a pair of dumbbells. Warm-up, a circuit that rotates muscle groups, a short cool-down.&lt;/li&gt;
&lt;li&gt;One day: either a harder conditioning piece or just a long walk if the week already hurt.&lt;/li&gt;
&lt;li&gt;If my shoulders are loud from the keyboard, I swap in stretching instead of pretending I am tough.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is the whole program. Full body beats a body-part split when you might miss Thursday. Missing one session should not orphan "leg day" until next month.&lt;/p&gt;

&lt;p&gt;Form matters more than a timer yelling at you. Knees tracking over the mid-foot on a squat, ribs down on a push-up, neck not cranked forward on everything. The site has a small exercise library with the moves drawn out, because I got tired of alt-tabbing to a 12-minute explanation of a glute bridge.&lt;/p&gt;

&lt;h2&gt;
  
  
  The site, briefly
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://homefitroutine.com/" rel="noopener noreferrer"&gt;homefitroutine.com&lt;/a&gt; is the timer I wanted.&lt;/p&gt;

&lt;p&gt;You pick a goal (full body, strength, a harder conditioning session, abs, legs, upper body, a stretch, and a few others), how long you have, and what is actually in the room: nothing, dumbbells, a band, a kettlebell, sometimes a pull-up bar. There is an apartment-friendly toggle for the days jumping would be a bad idea. It builds a warm-up, a timed circuit, and a cool-down. You press start and follow the clock.&lt;/p&gt;

&lt;p&gt;No signup. I did not want an account wall between me and the first squat. There are a lot of ready-made lengths, from 10 minutes to 45, if you do not feel like using the generator.&lt;/p&gt;

&lt;p&gt;If you only try one: the &lt;a href="https://homefitroutine.com/routines/20-minute-full-body-workout-no-equipment" rel="noopener noreferrer"&gt;20-minute full body, no equipment&lt;/a&gt;. Shoes optional. A bit of floor space is the only dependency.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2ynjv5phr3kqs5au47ja.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2ynjv5phr3kqs5au47ja.jpg" alt="Cooling down matters more when you go straight back to a chair" width="800" height="505"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  If you take one thing
&lt;/h2&gt;

&lt;p&gt;Do not build a new identity around fitness this week. Put a 20-minute session on the calendar next to the standup you already resent, and make the first step a button instead of a search.&lt;/p&gt;

&lt;p&gt;I still sit too much. The neck is quieter. That was the bar.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://homefitroutine.com/generator" rel="noopener noreferrer"&gt;Build one and start it&lt;/a&gt;. If something in the timer is annoying, tell me. I am still the one using it on Tuesdays.&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>health</category>
      <category>webdev</category>
      <category>showdev</category>
    </item>
    <item>
      <title>better conditional operator than javascript itself </title>
      <dc:creator>monsterooo</dc:creator>
      <pubDate>Wed, 20 Jun 2018 17:35:15 +0000</pubDate>
      <link>https://dev.to/monsterooo/better-statements-control-components-than-javascript-itself-5bii</link>
      <guid>https://dev.to/monsterooo/better-statements-control-components-than-javascript-itself-5bii</guid>
      <description>&lt;p&gt;In this &lt;a href="https://blog.logrocket.com/conditional-rendering-in-react-c6b0e5af381e"&gt;article&lt;/a&gt;, I've learned something but I'm also thinking about something.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conditional Operator
&lt;/h3&gt;

&lt;p&gt;Inline Conditional Operator is confusing example:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;condition ? expr_if_true : expr_if_false&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;view&lt;/span&gt;
      &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
      &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt;
            &lt;span class="nx"&gt;onChange&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handleChange&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;inputText&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or display a component based on its variable value&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;view&lt;/span&gt;
  &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
  &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt;
        &lt;span class="nx"&gt;onChange&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handleChange&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;inputText&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you have nested code 😰&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;condition1&lt;/span&gt;
      &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Component1&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;condition2&lt;/span&gt;
        &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Component2&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;condition3&lt;/span&gt;
          &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Component3&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I wonder if I can abstract this statement as a react component?&lt;/p&gt;

&lt;p&gt;Like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;If&lt;/span&gt; &lt;span class="nx"&gt;when&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;logic&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;↔️&lt;/span&gt;&lt;span class="nx"&gt;show&lt;/span&gt; &lt;span class="nx"&gt;component&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/If&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;If&lt;/span&gt; &lt;span class="nx"&gt;when&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;logic&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;↔️&lt;/span&gt;&lt;span class="nx"&gt;show&lt;/span&gt; &lt;span class="nx"&gt;component&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;If&lt;/span&gt; &lt;span class="nx"&gt;when&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;logic&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;other&lt;/span&gt; &lt;span class="nx"&gt;component&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/If&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/If&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I think it's more beautiful and readable&lt;/p&gt;

&lt;p&gt;There is a lot more&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Switch&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Case&lt;/span&gt; &lt;span class="nx"&gt;when&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;condition&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;condition&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Case&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Case&lt;/span&gt; &lt;span class="nx"&gt;when&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;condition&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;condition&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Case&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Case&lt;/span&gt; &lt;span class="nx"&gt;when&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;c&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;condition&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&amp;gt;}/&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Default&lt;/span&gt; &lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;component&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&amp;gt;}/&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Switch&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Determines multiple conditions and can display default components&lt;/p&gt;

&lt;p&gt;Iterate through the traversal &lt;code&gt;array&lt;/code&gt; or &lt;code&gt;object&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;For&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;c&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;{(&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;：&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;item&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&amp;gt;&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="err"&gt;}
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Default&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;component&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Default&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/For&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I created a &lt;a href="https://github.com/monsterooo/react-statements"&gt;repo&lt;/a&gt; for this&lt;/p&gt;

&lt;p&gt;Do you have any ideas?&lt;/p&gt;

&lt;p&gt;😮&lt;/p&gt;

</description>
      <category>react</category>
      <category>statements</category>
      <category>logic</category>
    </item>
  </channel>
</rss>
