Skip to content

Tag: reactjs

Using React packages in Astro

So I’ve started building a portfolio site for myself, gone with Astro as it’s now the cool new thing, so thought why not, was going to use Gatsby but this seems like the more performant solution and you have a lot of freedom with it (not tied in to a GQL CMS). As I understand it, Astro is a soluti…

Counter inside an onClick function

I have a button that adds a new div (onClick). I want to add +1 to cargoNumberCounter so that it shows that it’s a new div. I thought I could make it work like I have shown in the example, or by spreading the state like so setCargoNumberCounter([…cargoNumberCounter, cargoNumberCounter +1]), but fo…

Fetching data for another variable react

I have a question of something that looks pretty obvious but It’s getting hard for me. I know that for fetching data that will get actually rendered in a component you need to use reacthooks and useState. However I am having a problem because I need to fetch some data and then store it in a variable tha…

Adding Base URL in react.js project is not working

I want to add the base URL to my react.js project. However I had tried couple of methods that did not work. For example, if my project url is : It should appear in address bar as : Below is my project code. index.js App.js What I had tried? As I referred in stackoverflow and also many other websites, integrat…