R

Reactiflux

Reactiflux community. Join the community to ask questions about Reactiflux and get answers from other members.

Join Server

Community questions

RRinkusu3/25/2023

Rinkusu – 13-39 Mar 25

Hi, does anyone have an idea of how to modify only the non-transparent pixels of an image ? I don't find anything with canvas that suits this
Ddmikester13/21/2023

✅ – dmikester1 – 15-27 Mar 21

Is this a good room to ask a regex(in Javascript) question?
NNightSkyJeff3/21/2023

NightSkyJeff – 00-14 Mar 21

I am attempting to split one gzipped file (stream) into two gzipped files (streams). I have the readable stream, I am piping it through zlib.createGunzip(), and piping that to a readline function that reads a line from the stream and writes it to one of two streams, both of which are piping via zlib.createGzip(). The problem I am having is that the two resulting files are NOT gzipped.

const stream = GetSomeReadableGzippedStream();
const dest = 'out.%partition%.txt.gz';
const partitions = 2;
const outs = [...Array(partitions)].map((_, i) =>
    zlib.createGzip().pipe(createWriteStream(dest.replace('%partition%', i+1)))
);
let lineNum = 0;

const readline = async function* (stream) {
    const reader = ReadStreamLineByLine(stream);
    for await (const line of reader) {
        outs[lineNum++ % partitions].write(line);
    }
};

await pipeline(
    stream,
    zlib.createGunzip(),
    readline,
);
__mercury3/16/2023

✅ – _mercury – 19-49 Mar 16

How to get keys that has space ?
Image
Image
Eecholoid3/15/2023

✅ – echoloid – 13-55 Mar 15

May I know,
How the statement
import {react} from "react"

Able to find the actual react module present in the node_modules without using any absolute path like
'../node_modules/react'
Ddmikester13/14/2023

✅ – dmikester1 – 19-47 Mar 14

I have 2 objects with the same keys. I want to combine the objects into a single array of objects.
questions: Object {​​
crossContamination: "Is cross contamination at an acceptable level?",
mixer6Production: "Is anything being produced in mixer 6?",
product: "What product are we producing?",
barrelsEmptiedOnPiles: "Any mixed overflow barrels emptied on piles?",
binsLabeledCorrectlyOnCatwalk: "Are bins labeled correctly on catwalk level and readable?",
​binsLabeledCorrectlyOnGround: "Are bins labeled correctly on ground level and readable?",
​​comments: "Additional comments for product(s) concern or quality:",
​​crossContamination: "Is cross contamination at an acceptable level?",
​foreignProducts: "What are the foreign product(s)?",
​mixer6Production: "Is anything being produced in mixer 6?",
​overflowBarrelsEmpty: "Are the overflow barrels empty?",
​overflowInfo: "Additional information is required:",
​paintFloorWetDry: "Is the plant floor wet or dry?",
​product: "What product are we producing?",
​​properWeight: "Is scale set at the proper weight?",
}
​​
checkData: Object {
crossContamination: "No",
mixer6Production: "Yes",
product: "other one",​​
barrelsEmptiedOnPiles: "No",​​
binsLabeledCorrectlyOnCatwalk: "Yes",​​
binsLabeledCorrectlyOnGround: "No",​​
comments: "quality",​​
crossContamination: "No",​​
mixer6Production: "Yes",​​
overflowBarrelsEmpty: "Yes",​​
paintFloorWetDry: "Wet",​​
product: "other one",​​
properWeight: "No",
}
Ddmikester13/2/2023

✅ – dmikester1 – 16-24 Mar 2

I am trying to figure this issue out with this json-storage library. It does not support promises. My environments variable is always coming out empty. I know its because I need to wait for storage.get somehow.
⛄Snowberb⛄2/28/2023

⛄Snowberb⛄ – 13-38 Feb 28

What's the correct way of versioning an app? If the current version is 1.0.0, and I do a small update regarding minor changes, it should be 1.0.1 or 1.0.01 or 1.0.0.1
Bbrowinski2/27/2023

browinski – 12-52 Feb 27

Why adding a class like that gives word value in console?
then If I do classList.remove it can't see that second class
ImageImage
ImageImage
SScript2/25/2023

Script – 14-38 Feb 25

Is there any guide one how to build this in d3 js and add that hover effect to show the "risky" text
Image
Image
NNesho2/25/2023

✅ – Nesho – 10-41 Feb 25

Hello, I'm using d3 to render charts. I have a problem with generating an area with d3.area, the area is being generated outside of my svg size, even though I'm giving the y-scale the same size as my svg. Any ideas?
export function useD3Scales<T>({ data, xKey, yKey }: Options<T>) {
  const { width, height, margin } = useResponsiveContainerSize();

  const xScale = d3
    .scaleTime()
    .domain(
      d3.extent(data, (d, i) => {
        return xKey ? xKey(d) : i;
      })
    )
    .range([margin.left, width - margin.right]);

  const yScale = d3
    .scaleLinear()
    .domain(d3.extent(data, (d) => d[yKey]))
    .range([height - margin.bottom, margin.top]);

  return { xScale, yScale };
}
HHalcyonXII2/23/2023

HalcyonXII – 20-45 Feb 23

why is this giving me error handleCat is not a function
Image
Image
⛄Snowberb⛄2/23/2023

⛄Snowberb⛄ – 09-16 Feb 23

How could I force an api error from a production side? What I mean is to do it not from http://localhost:3000, but from the deploed website
HHalcyonXII2/18/2023

HalcyonXII – 16-29 Feb 18

Image
Image
PHPink Hat2/15/2023

✅ – Pink Hat – 00-54 Feb 15

in this code
this.pattern = [
    {
        method: new Function(`console.log(1)`),
        bulletDelay: 1000    
    } ,{
        method: new Function(`console.log(2)`),
        bulletDelay: 1000
        
    } ,{
        method: new Function(`console.log(3)`),
        bulletDelay: 1000
        
    }  
]

for (this.i in this.pattern) {

    setTimeout(()=>this.pattern[this.i].method(), function (i){
        this.z = 0;
        for (this.j = i-1; this.j >=0; this.j--) {
            try {
            this.z += this.pattern[this.j]?.bulletDelay
            } catch (error) {
                console.error(error)
            } finally {
                continue
            }
        }
        console.log(i)
        return this.z
        
    }(this.i))
    console.log(this.pattern[this.i])
    
}

why does this.pattern[2] get printed 3 times?
> 0
> {bulletDelay: 1000, method: ƒ}
> 1
> {bulletDelay: 1000, method: ƒ}
> 2
> {bulletDelay: 1000, method: ƒ}
> undefined
> 3
> 3
> 3

When it should be printing
> 0
> {bulletDelay: 1000, method: ƒ}
> 1
> {bulletDelay: 1000, method: ƒ}
> 2
> {bulletDelay: 1000, method: ƒ}
> undefined
> 1
> 2
> 3
PHPink Hat2/14/2023

✅ – Pink Hat – 23-03 Feb 14

What are the arguments in an arrow function when it is inside of a setTimeout() function
setTimeout((a, b) => {...}, ...)
PHPink Hat2/13/2023

Pink Hat – 22-12 Feb 13

why do I get this error with this code?
ImageImage
ImageImage
⛄Snowberb⛄2/9/2023

⛄Snowberb⛄ – 07-57 Feb 9

Having an interceptor do redirect to the login page when a certain status is seen, how could I do to not run the code for each of the api calls? auth.onLogout() gets called for each one of the responses that get 401
window.fetch = async (...args) => {
    const [resource, config] = args;
    const response = await originalFetch(resource, config);

    if (response.status === 401) {
      auth.onLogout(true);
      setAlertState({ title: 'La sesión ha expirado', type: 'alert' });
    }

    return response;
  };
Kkairu2/7/2023

kairu – 14-23 Feb 7

I have a section in my code I don't really understand.

function nameOfFunction(a, b = null, c = null) { }

what does setting the something to = null in the parameters do?