Public Ticket #463

Double rendering

Closed
Comments
DexignLab
Norberto replied privately 2 years ago on September 23, 2021 at 03:46 PM
replied private
DexignLab
Khelesh Mehra replied 2 years ago on September 23, 2021 at 07:21 AM

Hello Sir,

Please try that code, your both problem we will resolve.

Thanks

Khelesh M

DexignZone Team

DexignLab
Norberto replied 2 years ago on September 22, 2021 at 01:17 PM
Thank you.


And when removing this, does something break in the app? because if it is, I imagine that a specific function must execute.

Please if you can answer my first and second question.

Norberto.

DexignLab
Khelesh Mehra replied 2 years ago on September 22, 2021 at 07:17 AM

Hello Sir,

Please check the screenshot to change some code.

check: https://prnt.sc/1t78vnj 

File Path: gymove\src\App.js

Thanks

Khelesh M

DexignZone Team

DexignLab
Norberto replied 2 years ago on September 20, 2021 at 12:22 PM

Another problem that it detects, is that changing the size of the layout, it re-renders everything, and therefore it also calls the APIs again.

I don't think this is a problem, but it can consume unnecessary resources.

attached files:

DexignLab
Norberto replied 2 years ago on September 20, 2021 at 12:01 PM
Hello, the problem is not CSS, the problem is that the app is rendered twice, and if I have an API call, it is also called twice.


And I think it is related to how the routes are rendered with the .map method.

So the probe could be fixed by creating the independent <Routes>, but I lose the visual styles.

Check the login page, I have added a call to a public API, and you will see that it is called twice.

Thanks.

attached files:

DexignLab
Khelesh Mehra replied 2 years ago on September 20, 2021 at 07:22 AM

Hello sir,

Please check CSS files that is including or not.

or

can you share your update package zip here to check it that what is the CSS issue.

Thanks

Khelesh M

DexignZone Team

DexignLab
Norberto replied started the conversation 2 years ago on September 18, 2021 at 12:23 AM

Dear.

First of all, sorry, I am using the translator, since my native language is Spanish.

I am editing the theme based on react.

But I'm noticing that on many occasions it renders 2 times, and it also makes calls to an API twice (in case of having a fetch).

From what I see, this is due to the way routes are rendered, using the map method.

Example, in the login page, I add this code:

const getData = () => {
return fetch('https://jsonplaceholder.typicode.com/todos/1');
};

useEffect(() => {

const func = async () => {
const data = await getData();
const value = await data.json();
console.log(value)
};
func();

}, [])


When I check the console, when the page loads, it makes the call twice, I can't allow that.

If I replace the routes in the "routes.map" with a single normal route:

<Switch>

<Route
exact
path={`/path/`}
component={<Login/>}
/>

</Switch>


the problem is solved, the issue is that I lose the styles that are conditionally in the DIV container of the Routes.

I would like to know how to solve this problem.

On the other hand, in the demo that comes in HTML, the calendar allows you to create events, the react version does not allow this and it looks different.

Thanks.

attached files: