Find Jobs
Hire Freelancers

Correct error in react setState( BinanceAPI .data)

$10-30 USD

Closed
Posted almost 4 years ago

$10-30 USD

Paid on delivery
Hi, can anyone help me with this code in react? I'm trying setState based on Binance API It returns error... "error" "Unhandled Rejection (Error): ws does not work in the browser. Browser clients must use the native WebSocket object" this is my code ``` import React, { useState, useEffect } from 'react' // Node Binance API // [login to view URL] const Binance = require('node-binance-api') const binance = new Binance().options({ APIKEY: 'xxxxxxxxxx', APISECRET: 'xxxxxxxxxx' }) // BTCUSDT - price const BtcPriceTicker = () => { const [btcPriceTicker, setBtcPriceTicker] = useState([]) useEffect(() => { async function fetchMyAPI() { let response = await [login to view URL]( 'BTCUSDT' ) response = [login to view URL] setBtcPriceTicker(response) //[login to view URL](response) } fetchMyAPI() }, [btcPriceTicker]) return <div>{btcPriceTicker}</div> } export default BtcPriceTicker; // error // Unhandled Rejection (Error): ws does not work in the browser. // Browser clients must use the native WebSocket object ``` [login to view URL] using Node Binance API [login to view URL]
Project ID: 26302926

About the project

4 proposals
Remote project
Active 4 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
4 freelancers are bidding on average $22 USD for this job
User Avatar
Pozdrav. Ja sam full-stack web developer i mogu ti pomoci, posalji mi poruku pa da pokusamo da resimo taj problem.
$20 USD in 1 day
5.0 (8 reviews)
3.8
3.8
User Avatar
I have more than 5 years of experience in IT industry with PHP, RDBMS, NodeJS, React, HTML, JS, CSS, JQuery, Bootstrap, AJAX, JSON etc.
$13 USD in 2 days
0.0 (0 reviews)
0.0
0.0
User Avatar
First of all you are calling setbtc... state updater in useeffect and set its value as condition for useeffect call which will keep re rendering the component again and again
$35 USD in 1 day
0.0 (0 reviews)
0.0
0.0

About the client

Flag of CROATIA
Zagreb, Croatia
0.0
0
Member since Jun 28, 2020

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.