JorrinKievit / react-ts-tradingview-widgets

This is a React component library for TradingView Widgets
https://tradingview-widgets.jorrinkievit.xyz/
MIT License
154 stars 48 forks source link

Reload every time states change #22

Closed SaeedPoureshghi closed 1 year ago

SaeedPoureshghi commented 1 year ago

Hi; Because of re-rendering the page when any state changed it is refreshing too. I used websocket to update data on page. on every data update trying to refresh widgets and sucks.

SaeedPoureshghi commented 1 year ago

Solved before!

JorrinKievit commented 1 year ago

How did you solve it? 🙂

SaeedPoureshghi commented 1 year ago

using memo:

widget.js

import React from "react";
import { memo } from "react";
import { TechnicalAnalysis } from "react-ts-tradingview-widgets";
const Widget = (props) => {
  return <TechnicalAnalysis symbol="BINANCE:BTCUSDT" colorTheme="light" />;
};

export default memo(Widget);

reference : https://www.w3schools.com/react/react_memo.asp