This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is working as designed. There is a longer discussion about this in #14110 if you're curious. | |
Let's say for some reason you have AppContext whose value has a theme property, and you want to only re-render some ExpensiveTree on appContextValue.theme changes. | |
TLDR is that for now, you have three options: | |
Option 1 (Preferred): Split contexts that don't change together | |
If we just need appContextValue.theme in many components but appContextValue itself changes too often, we could split ThemeContext from AppContext. | |
function Button() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function changeArr (arr) { | |
arr.push('another suburb') | |
} | |
const suburbs = ['Luctwyche', 'Chemside'] | |
changeArr(suburbs) | |
console.log('suburbs is ', suburbs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function changeNumber (thing) { | |
thing = thing + 1 | |
} | |
const myNumber = 123 | |
changeNumber(myNumber) | |
console.log('my number is ', myNumber) | |
function changeString (str) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// --- Directions | |
// Given an array and chunk size, divide the array into many subarrays | |
// where each subarray is of length size | |
// --- Examples | |
// chunk([1, 2, 3, 4], 2) --> [[ 1, 2], [3, 4]] | |
// chunk([1, 2, 3, 4, 5], 2) --> [[ 1, 2], [3, 4], [5]] | |
// chunk([1, 2, 3, 4, 5, 6, 7, 8], 3) --> [[ 1, 2, 3], [4, 5, 6], [7, 8]] | |
// chunk([1, 2, 3, 4, 5], 4) --> [[ 1, 2, 3, 4], [5]] | |
// chunk([1, 2, 3, 4, 5], 10) --> [[ 1, 2, 3, 4, 5]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Dispatch } from 'redux'; | |
import { ThunkAction } from 'redux-thunk'; | |
import { getStore, IState } from './my_store'; | |
let store = getStore(); | |
// Create myThunkAction function with a type of ThunkAction<R, S, E> | |
let myThunkAction: ThunkAction<Promise<string>, IState, null> = | |
(dispatch: Dispatch<IState>, getState: () => IState) => { | |
return new Promise<string>((resolve, reject) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bind to backtick | |
unbind C-b | |
set-option -g prefix ` | |
bind ` send-prefix | |
set-window-option -g mode-keys vi | |
# Setup 'v' to begin selection as in Vim | |
bind-key -t vi-copy v begin-selection | |
bind -t vi-copy y copy-pipe 'xclip -in -selection clipboard' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Remove logs from volumes | |
docker volume rm $(docker volume ls -qf dangling=true) | |
### Remove unused containers and images | |
docker rm $(docker ps -q -f 'status=exited') | |
docker rmi $(docker images -q -f "dangling=true") | |
### start local postgres, mysql databases | |
docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD='' -e POSTGRES_DB=abx_modules_test --name "postgres" -d postgres | |
docker run -p 3306:3306 -e MYSQL_USER=root -e MYSQL_ROOT_PASSWORD='' -e MYSQL_DATABASE=bclconnect_test -e MYSQL_ALLOW_EMPTY_PASSWORD=yes --name "mysql" -d mysql | |
docker run -p 27017:27017 --name "mongo" -d mongo:3.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"> | |
<s:Header> | |
<a:Action s:mustUnderstand="1">JobBookingResponse</a:Action> | |
<a:MessageID>urn:uuid:ed3d1e61-aa7c-490a-a1ee-9d297e938a20</a:MessageID> | |
</s:Header> | |
<s:Body> | |
<ns0:JobBookingResponse xmlns:ns0="http://ECL.Online.BT.JobBooking.JobBookingResponse_v1_5_XML.xsd"> | |
<ns0:RespType>RE</ns0:RespType> | |
<ns0:MessageID>TMND27049419</ns0:MessageID> |