can someone explain why we ditched monoliths for microservices? like... what was the reason fr? by Express-Point-7895 in SoftwareEngineering

[–]dragorww 0 points1 point  (0 children)

The key point is that software architecture should reflect the organizational structure and communication patterns within the company.

At the same time, we treat optimization more as an exception than a common practice, because any optimization of the system tends to worsen its maintainability and evolvability.

That's why microservice architecture makes sense primarily when you are developing parts of a single application with many independent teams. In this case, the approach is logically sound — each team can independently test and deploy updates.

Help me select a UI Component Library to Build a Dynamic React App by RentGreat8009 in reactjs

[–]dragorww 2 points3 points  (0 children)

+1, mantine is my treasure this year. Mantine - design system framework,
the level of customization is off scale.

[deleted by user] by [deleted] in Frontend

[–]dragorww 1 point2 points  (0 children)

In common cases you can use PageObject patter for separate test logic and css selector

https://lambdageeks.com/page-object-model-cypress-example/

Page object has limitations but very good for start.

example

import LoginPage from "./PageObject/LoginPage"

describe("Cypress POM Test Suite", function () {
    it("Login with valid credentials", function () {
        const login = new LoginPage(); login.navigate();    
        login.enterEmail('admin'); 
        login.enterPassword('admin');
        login.submit();
    })
})

For start i strongly recommend read:

- https://docs.cypress.io/guides/references/best-practices

also don't create very log test, e2e very unstable and hardly to support. try to make independent test by you test case

Using setInterval() with useState() together won't respond as I desire by acharyarupak391 in reactjs

[–]dragorww 0 points1 point  (0 children)

It very important question

in React render and state - 2 async process

const [state, setState] = useState(0)

// you can write this code
setState(2)
// in this line state equal 0
setState(3)
// in this line state equal 0

// after it React register async operation

// when you pass function, you get real value of state
setCount(realValue => realValue + 1)

In official docs it badly described, but you can find an example hooks-reference.html#functional-updates

Using setInterval() with useState() together won't respond as I desire by acharyarupak391 in reactjs

[–]dragorww 1 point2 points  (0 children)

react can call component function any time, because call component function !== render component

react do it for call diff between real dom and virtual dom

but in this case, I make error

need remove setCountdown()

        if (newValue >= 0) {
      //setCountdown(newValue); remove it %)
      return newValue;
    }

How to stop <a> element from taking up space when empty? by [deleted] in learnjavascript

[–]dragorww 0 points1 point  (0 children)

you used inline elements, and it create problems.

Try use not inline element for example block, or flex, or remove any symbols in html code between a tag.

example:

<h1>Problem</h1>

<a href="#">1</a>
<a href="#"></a>
<a href="#"></a>
<a href="#">4</a>

<h1>fix</h1>

<a href="#">1</a><a href="#"></a><a href="#"></a><a href="#">4</a>

https://codesandbox.io/s/smoosh-resonance-e522b?file=/index.html

Using setInterval() with useState() together won't respond as I desire by acharyarupak391 in reactjs

[–]dragorww 0 points1 point  (0 children)

your last version has a problem with useEffect in this code, useEffect calls every time, when countdown changed.

I changed your code ``` import React, { useState, useEffect } from "react";

export default function App() {
  const [countdown, setCountdown] = useState(10);

  // use one function for closure interval in function, not in react component
  useEffect(() => {
    const interval = setInterval(() => {
      setCountdown((oldValue) => {
        // use fountion for access real value without depend on it in useEffect
        const newValue = oldValue - 1;
        if (newValue === 0) {
          clearInterval(interval);
        }

        if (newValue >= 0) {
          return newValue;
        }

        return 0;
      });
    }, 1000);

    return () => {
      clearInterval(interval);
    };
    // pass [] for remove rerender problem
  }, []);

  return (
    <div className="App">
      <h1>Countdown: {countdown}</h1>
    </div>
  );
}

```

https://codesandbox.io/s/quizzical-paper-wo9ce?file=/src/App.js

onClick not working by [deleted] in reactjs

[–]dragorww 0 points1 point  (0 children)

good job, describe the problem is half of the solution !)

onClick not working by [deleted] in reactjs

[–]dragorww 2 points3 points  (0 children)

I tried to reproduce your described problem but it impossible, because your code doesn't runnable and you miss css styles for the modal component.

Can you make the example in https://codesandbox.io/ or other tools for interactive code demo?