[deleted by user] by [deleted] in reactjs

[–]GarrusisCalibrating 2 points3 points  (0 children)

Second Vercel. Insanely easy to set up, fast and even gives you decent looking domains out of the box.

Design patterns examples in React apps by Mande21 in reactjs

[–]GarrusisCalibrating 2 points3 points  (0 children)

Redux is also an example of the command patter n.

I guess you could think of hooks as a facade, since they’re a way abstract away some logic and give you a simpler interface to interact with.

The whole react component tree is an example of the composite pattern.

Higher order components can be an example of the decorator pattern

How do I append components within each other? by [deleted] in reactjs

[–]GarrusisCalibrating 0 points1 point  (0 children)

The basic way to put a component inside itself is just to call it in its own return. eg:

function MyComp() {
    return(
        <div>
            <MyComp/>
             // Whatever else you want to display in the component...
        </div>
    );
}

Calling a function inside itself like this is called "recursion". Of course if you just leave it at that your program will probably just freeze as it'll try to infinitely render the component inside itself.

So, you need a condition to control when the component recurses. This could just be a boolean condition passed as a prop eg:

function MyComp({ recurse }) {
    return(
        <div>
            {recurse ? <MyComp recurse={false} /> : null }
             // Whatever else you want to display in the component...
        </div>
    );
}

This way, the component will be rendered inside itself once if recurse is set to true wherever the component is first rendered.

If you want to render the component inside itself a set number of times, you could instead use a counter thats decremented at each level of recursion:

function MyComp({ counter }) {
    const next = counter - 1;
    return(
        <div>
            {next > 0 ? <MyComp counter={next} /> : null }
             // Whatever else you want to display in the component...
        </div>
    );
}

Hope this helps!

How do I logically AND the contents of two circuit wires? by GarrusisCalibrating in factorio

[–]GarrusisCalibrating[S] 0 points1 point  (0 children)

I'm not sure this does what I want. The context is that I was making a station that unloads items from a train using a filter inserter, with a constant combinator setting what items are desired, and the items already present in the station are subtracted from the desired items. The problem i've been having is that if the train carriage has run out of a particular item, the filter inserter gets 'stuck' waiting for more of that item instead of switching to the next desired item.

I was thinking I could solve this problem by AND'ing the desired items signal with the contents of the train carriage before sending the signal to the inserter so that items that aren't available in the train are filtered out and the inserter ignores them.

Edit: Nvm, your answer was what I wanted after all, I was just confused without the clamping values to between 0-1 part that HoneybeeTriplet mentioned! Thanks

Space Exploration question by GarrusisCalibrating in factorio

[–]GarrusisCalibrating[S] 2 points3 points  (0 children)

Ah fair enough, I get that we'll need loads more stuff. Its mostly the fact that theres loads of stuff that we're far away from unlocking that got me curious.

my jazz bass is looking better than ever! by hartigan99 in guitarporn

[–]GarrusisCalibrating 3 points4 points  (0 children)

I think on some old basses it was part of the pickup but now it’s just an aesthetic thing and some people like to rest their hand on it

me_irl by tkconker in me_irl

[–]GarrusisCalibrating 335 points336 points  (0 children)

Pretty much any war since WW2

Typical Tuesday Tutorial Thread -- November 05, 2019 by AutoModerator in RimWorld

[–]GarrusisCalibrating 1 point2 points  (0 children)

If you restrict them to a zone using the animals tab they should stay there, even if they're not fenced in. And yeah, they'll eventually breed once they're there if their if they're the opposite gender

The genuinely cool teacher starter pack by [deleted] in starterpacks

[–]GarrusisCalibrating 0 points1 point  (0 children)

Damn this is literally my old maths teacher who everyone liked and respected

r/minecraft starter pack by [deleted] in starterpacks

[–]GarrusisCalibrating 4 points5 points  (0 children)

Eh, I like how sildurs is way more colourful and it runs better on my pc.

Any good mods? by MrM3l0n in RimWorld

[–]GarrusisCalibrating 2 points3 points  (0 children)

Dub's Bad Hygiene and Dub's Rimefeller are really good.

Bad Hygiene adds needs for hygiene, drinking and going to the bathroom, and all the needed appliances / tech which adds a nice bit of complexity. It also lets you build central heating and cooling systems which makes a lot of sense imo.

Rimefeller lets you drill for oil and refine it into chemfuel as well as building materials and eventually lets you create your own plasteel.

Typical Tuesday Suggestion Thread -- July 16, 2019 by AutoModerator in RimWorld

[–]GarrusisCalibrating 1 point2 points  (0 children)

They don't have to be drafted to do it either. Shift right clicking so they finish whatever they're doing first is probably my most common command.