??. Of course, you don’t need TypeScript to use it — you can either configure Babel to enable this feature, or just wait until it lands in the ECMA standard.
Let’s talk about why you’d want to use it, rather than the usual double pipe operator. Consider this example:
The boolean problem
const chickenPref = false;
const globalPref = true;const serveUserChicken = chickenPref || globalPref; // evaluates to true
This user has been crystal…
I suspect that there’s a certain personality type that is drawn to programming. The type of person that must be solving problems and learning new things, because without this drive, it’s hard to get ahead. But this career drive can be a double-edged sword, making it difficult to maintain a balance in life and prevent long-term damage to one’s health.
When I got my first real coding job at a Rails consultancy, there were a few lifestyle changes that came along with the new job that I didn’t pay much attention to at first, but over time had insidious consequences…
Ant (GitHub) is much more than a React UI kit with a minimalist design aesthetic and every component under the sun. It is a rabbit’s hole that leads to a giant maze of interconnected libraries, with a serious ecosystem surrounding it. There’s a custom build tool based on Webpack called ant-tool, several CLI apps, community scaffolds, and a complete framework (dva, which has its own CLI as well). And the UI components are mini-projects in and of themselves — see this repo for information on each component.
Warning! This design post does not contain any drawings or diagrams. It’s a different approach, but hang in there — I find that it makes it easier to remember concepts when you have to visualize them yourself.
Fetch is a fantastic networking API that was chosen for React Native, but because it is relatively new, there are a few things to be aware of when using it. The React Native Documentation does include a single example, which is a good start, but I want to add a few more things that may not be readily obvious.
Sending a GET request to a JSON API is the simplest use case. Just call fetch and supply it with the appropriate URL. It returns a promise that can be parsed as usual: