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...)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...)The task is to make clickable div tags. There are several div blocks in a page, each div contains a hyperlink with URL. You need to make so, that if you click on div element, you open a hyperlink.
(read more...)Javascript never had good ways to use multiline strings before ES6 had appeared. In ES6 you can use template literals – strings delimited by backticks instead of quotes, single or double. But what to do if you can not use ES6 possibilities?
(read more...)