so my question is I have a react application in this application I used material UI for only two components and I installed npm i @materialui/core so basically, I installed all material UI library but I only used 2 components of that big library will this cause my application to have bigger bundle size or whe…
Tag: reactjs
Logo float on basic responsive nav
Problem ” float: right” poorly working in responsive class Basically, I am trying to place my image logo in the right-up corner for a semi-lang case but every manipulation on .logo force navigation bar to change its values. Question How can I align the logo to the right-up corner? What I’ve …
Wait for browser to render element in React
I’m using CSS transition with top and left to animate the movement of an element in React. To achieve this, the component must first be rendered with top: 0; left: 0, and then re-rendered with altered top and left properties to start the transition. This is my component: I expected the component to be r…
Find array object by ID and return it in React
I try to fetch object vorlagen with ID 6310 from this API and want to show if property vorlageAngenommen is true or false. The JSON object looks as follows: My code that does not run, looks as follows (I am not sure if this is a good base at all): I created a sandbox as well that can be found
How can I prevent a react component to render every time parent component renders?
I have a single TextField input on one form, the problem is that when I type on it the displayed/render of the value just typed has a kind of delay, and I want to prevent this. Context: The TextField is label, name and id come from a state object called ‘formInput’ and they change their value ever…
React not getting different images for same URL
I am making a users page with arbitrary data and noticed that since the image URL is the same (https://source.unsplash.com/random) the image is the same. How can I prevent this? Answer That is because, your browser caches your url and assumes you are hitting the same url so it populates previous result. Add a…
My React state doesn’t update when setState is called
I’m trying to make a simple animation when the burger element is clicked I’m trying to update the following state with an animation when the burger is clicked but the state doesn’t update no matter what i try. Edit: Someone suggested i post the full code Answer There’s a lot of bad sme…
React – How to fix very inconsistent disabled button countdown (i.e., several whole seconds)
I’m using setTimeout() (I even tried driftless too) to change buttons from disabled = true to disabled = false 3 seconds after appearing on the DOM (onLoad=). The buttons appear in sequence, after the previous button has been clicked. The problem is, the setTimeout() goes absolutely haywire: Each button…
Prevent infinite loop in useEffect when setting state
I am currently building a scheduling app. If a user selects two dates, I am attempting to select all date blocks between the two selected dates in the calendar as well. I am able to achieve this, but it causes my useEffect to fire into an infinite loop because I have state as a dependency in my useEffect wher…
Output data from form on the page react
I am writing todo app. There are main files in my directory now: App (rendering main page with header and buttons) TodoForm (create a form) TodoBox (generating list of tasks) And the question is: how I can pass the state from TodoForm to TodoBox in App (it is initialize as an empty array now). I want to outpu…