Today I Learned

This project exists to catalogue the sharing & accumulation of knowledge as it happens day-to-day. Posts have a 200-word limit, and posting is open to any Rocketeer as well as selected friends of JetRockets. We hope you enjoy learning along with us.

2 posts by Dmitry Sokolov

JS: Parsing URL

So far, I have used the indexOf operator or regular expressions to get query string values. Today I learned how to make it easier using the URLSearchParams API:

// Assuming "?post=1234&action=edit"

let urlParams = new URLSearchParams(;

console.log(urlParams.has('post')); // true
console.log(urlParams.get('action')); // "edit"
console.log(urlParams.getAll('action')); // ["edit"]
console.log(urlParams.toString()); // "?post=1234&action=edit"
console.log(urlParams.append('active', '1')); // "?post=1234&action=edit&active=1"

Important: Does not work in IE

Integrate Drawer inside Stack Navigation in React Native

I wanted to use more than one navigation in a React Native app. The documentation didn’t give a clear way to implement this.

Here is what you can do on purpose to add several types of navigation in your React Native app:

import { createStackNavigator, createDrawerNavigator } from 'react-navigation';
import * as Screens from './screens/index';
import Drawer from './components/DrawerMenu';
import getDrawerWidth from './utils/scale';

const AppStackNavigator = createStackNavigator({
  home: {
    screen: Screens.MainScreen,
  about: {
    screen: Screens.AboutScreen,

const AppNavigator = createDrawerNavigator(
    home: {
       screen: AppStackNavigator,
    contentComponent: Drawer,
    drawerWidth: getDrawerWidth,
    headerMode: 'none',

export default AppNavigator;