451 Followers
·
Follow

Confused about this error? So was I. Let’s solve it.

Image for post
Image for post
Photo by FuYong Hua on Unsplash

If you’re getting this error, there’s a couple of things you can try right away to fix it.

I was able to solve this problem by using component syntax instead of function syntax. I‘m not sure why, but it fixed my problem.

TLDR;

  • Only call hooks from the top level of a component, and never put them in conditional statements.
  • Make sure you only call hooks from within a React Component.
  • Further, pass the component around using Component syntax <MyComponent /> instead of calling the function component directly myComponent() !

First, double check that you’re not calling hooks within a conditional statement. The Hooks documentation makes clear that we are to use hooks at the top of our components, and without nesting them within conditionals. …


In part 2 of this TradingView JS API Example Guide, we will be implementing Realtime price updates on the chart. Make sure to read the Introduction, and Part 1 first

Image for post
Image for post
Photo by toine Garnier on Unsplash

To get realtime updates to the chart, we are continuing from Part 1 where we setup a basic charting widget for static data.

This example will use CryptoCompare’s trade level websocket connection to get price updates as they happen.

You can see the demo deployed here on Glitch, and see the code for part 2 here

Part 1 focused on setting up the TradingView Charting Library widget, and getting the JS API to get historic bars from our data source. …


This series is a work in progress, and I will be finishing this guide, covering more TradingView features, as well as enhancing the existing posts. I hope to make this process easier for everyone, so your feedback is greatly welcomed!

TradingView is the most popular tool for Crypto Charting, many exchanges and sites integrate their free Charting Library to provide a powerful charting interface that traders are familiar with.

However, the process of getting up and running with the charting library is confusing and poorly documented. This is evidenced by the large number of similar issues submitted to the project.

My goal with this tutorial series is to show you how I went about setting this up myself, using CryptoCompare as a free source of price data.

About

Jon Church

Javascript Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store