Using MUI V5, how can I pass a custom style to a button component? Here is what I have been trying to merge the old way with the new MUI v5 but it’s not working. Now I would like to call this Button and give it color=”secondary” Answer It looks like your code was an attempt to migrate from c…
Why does this Vue 3 form validation script fail?
I am working on a Users CRUD application with Vue 3. I run into trouble while trying to validate the data in the “Add New User” form. More precisely, I use the function below to make sure no form field is empy: For a reason I could not figure out, the formErrors array looks like this [“The e…
React: Selecting an element by id prints the wrong element
Hello! So, I am working on this list in react, when I add two elements to my list, and remove the first one added, it prints the other element that is left in the list. Is this normal? the ‘id’ is applied on creation of the list element and contains the title + unique ID applied to the object. Not
Is it faster to use one for-loop or use multiple built-in methods?
So I was recreating the ????-Sigma function in Javascript in two different ways and was wondering, which one of the methods is faster: function capitalSigma(start, end, func) { var sum = 0; for (…
Add row in google Spreadsheet with javascript
Adds the value below the line created earlier. I’m trying to get me to add a line at “2:2” and put the value on that line, and the other values stay below. The maximum result I got so far was to make the new line erase the old one and paste the new value in the same field. Any solutions…
Validate array object – Swagger/NestJS
I am wondering if there’s a way to create a dto to validate array of object? Example array: At the moment I have this, while it works, it isn’t what I am after. Answer Just use ParseArrayPipe: Update your Controller: Ensure to have items and whitelist set. Update your DTO:
combine regex to match subgroups in different order
I have a string with may have one of the 2 below structure some examples would be The goal is to match as below I can manage to get the result with 3 regex, but not with 1 How can I get the expected result with a single regex ? Answer Maybe use | to separate possible matches: Also note
Change CSS with JS for a toggled class
I’m learning JS right now, and I trying to do the following: I’m creating an html grid, each cell is marked with a cell class which doesn’t give it a background color. When I mark the cell (i.e by clicking), the JS code adds it a colored class, which gives it background color: Now, I’m…
How to write an XML file with certain format using JS?
I am trying to write an XML document from an HTML form using JavaScript with the following function: JavaScript function: The file that is generated has the following format: I am trying to modify the method in order for the nodes to have the following format: I know that setAttribute() doesn’t work bec…
How to pass the object to action in slice?
I need to pass userId and userNickname to action authUser in authSlice reducer. authSlice: calling dispatcher Answer Simply dispatch(authUser({ userId, userNickname })); which is equivalent to dispatch(authUser({ userId: userId, userNickname: userNickname }));