Relative Content

Tag Archive for javascriptreactjsfrontend

deploy react production build on an alb dns using rule path

In AWS i have an alb setup which will reroute /frontend/* to the frontend target group.
now when iam setting up homepage in package json “/frontend/” it works with development mode.
but when doing it with the production build it is not working.
It was unable to load js css files as the path got messed up in index.html.
When testing on
create react app it was the same problem it doesn’t load the files as the path is incorrect.
When setting the homepage what precautions to take in package.json.

Cannot get setState to work on adding an array

I’m having an issue getting my setState() ‘setSections(data.sections)’ to work. I’m trying to save data locally and is successful, as on reload the loaded data from the previous session is shown in the returned JSON.

How to move component to the top of the list when changing its state in React

I am creating my first project in React which essentially is a big list of pictures that are being sorted a specific way (and you can like/dislike them). Data is gathered from an API. I was able to do sorting between routes based on amounts of likes and dislikes and wanted to add a favourite button, which will put the favourited item to the top of the list, but I actually got stuck trying to figure it out. I thought about creating starred state and change it when user click the star button but sorting mechanism is done in another component.