Unlike classic Javascript applications, React works with Virtaual DOM, that’s why it’s not obviously how to add or remove class to the element. I will write about one of the ways how to make it.
(read more...)Unlike classic Javascript applications, React works with Virtaual DOM, that’s why it’s not obviously how to add or remove class to the element. I will write about one of the ways how to make it.
(read more...)We have an array of strings in React Application. Let's call it 'selectedParticipants'. And for the summary page we need to write all the members of array in one line with comma ',' between elements and dot '.' in the end in JSX block. Here is a small snippet.
(read more...)Sometimes you need to get the parameters and values from the query string in your JavaScript/TypeScript applications. If you don't want to spend the time on making your own methods, you can use this one with URLSearchParams.
(read more...)While the developing, especially while the code cleaning, you often want to know if your method is used or not. It’s usually when you make some temporary methods to determine the optimal one. Visual Studio shows the reference count by default, but Visual Studio Code doesn’t do that. But it’s very useful. Here is how to turn it on.
(read more...)We have a string with an URL. And we want to get the host URL. I don't know about the built-in functions for this and I don't think that you should find external libraries for this. Although, it's a good idea to create your own personal class.
(read more...)A JS/TS useful snippet to return only several last records with sorting by time. The data is stored in localStorage. I can't modify the types for external component, so that's why all the data has string types. and I use 'moment' to convert the strings to the date format.
(read more...)The React snippet of how to update the selected element in the array of objects. The array of objects is connected with useState hook, and on change of Checkbox control the array must be updated.
(read more...)I spent a lot of time to understand how to get async data from web-services and to set it to vars in React
I need to try to change 'fetch' to 'axios'
(read more...)There are 5 buttons on a page. If you click 1, 3 or 4 there must be one action, for 2 and 4 another one. You don’t have to write the same action for each control, like this:
(read more...)Recently I started to learn ReactJS. I could manually install the environment in NodeJS for ReactJS – WebPack, ReactJS, Babel and others. But to make solutions easier, I decided to use Create-react-app. Unfortunately, I got the error "create react app npm ERR! Maximum call stack size exceeded".
(read more...)