Skip to content

Tag: javascript

Value from response is undefined ReactJs

I’m trying to get values from trains such as id and number, but when I try to do that, no values shows. When I try to console.log that I get response of undefined. It works well with station.name and station.city but i does not work with station.trains.is. Here is my code: And here is the response I get…

React Hook “useState” is called in function

I have button click system and it works. Now I want to fetch the API inside the function. So, change the function clickCreate like this However there comes error like this. I should not use useState and useEffect in function, but how can trigger the API by btn click?? Answer You should move the hook to compon…

Highcharts pass external variable to global options

First time working with highcharts-vue. I have the following global chart options, which I import in my app.js. It is here I have added a button to the exporting menu to allow for download CSV / XLSX functionality, leveraging maatwebsite/laravel-excel, as the final export will include additional columns to sh…

React Context Provider all children re rendering

can someone explain to me why the next code re renders all children components from the provider console everytime button is clicked, all components re rendering but if context provider is wrapped in a component as follows console when button is clicked only the component consuming the context (and the compon…