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 RelayEnvironmentProvider from 'react-relay/lib/relay-experimental/RelayEnvironmentProvider'; | |
import useLazyLoadQuery from 'react-relay/lib/relay-experimental/useLazyLoadQuery'; | |
// ScreenA | |
function ScreenA() { | |
const { root } = useLazyLoadQuery(ScreenAQuery, null, { | |
fetchPolicy: 'store-or-network', | |
}); | |
return ( | |
<RelayEnvironmentProvider environment={environment}> |
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 useLazyLoadQuery from 'react-relay/lib/relay-experimental/useLazyLoadQuery'; | |
function Component () { | |
const { root } = useLazyLoadQuery(ScreenAQuery, null, { | |
fetchPolicy: 'store-or-network', | |
}); | |
... | |
} |
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
// ScreenA | |
const ScreenAQuery = graphql` | |
query ScreenAQuery { | |
root { | |
me { | |
name | |
} | |
} | |
} | |
`; |
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
#!/bin/bash | |
set -e | |
echo "Rename files" | |
for file in $(find src/ -name "*.js" | grep -v __generated__ | grep -v __tests__); do | |
mv "$file" "${file%.js}.ts" | |
done | |
echo "Removing type import keyword..." |
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
class ProfileName extends React.Component { | |
componentDidMount() { | |
profileInfoViewed('ProfileName', this.props.profile); | |
} | |
render() { | |
return ( | |
<View> | |
<Text>{this.profile.name}</Text> | |
</View> |
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
const profileInfoViewed = (fromComponent, profile) => { | |
const { id, name, age, homeLocation } = profile; | |
eventsAPI( | |
'ProfileInfoViewed', | |
fromComponent, | |
{ id, name, age, city: homeLocation.title } | |
); | |
}; | |
export const profileInfoViewedFragment = graphql` |
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
class ProfileName extends React.Component { | |
componentDidMount() { | |
profileInfoViewed('ProfileName', this.props.profile); | |
} | |
render() { | |
return ( | |
<View> | |
<Text>{this.profile.name}</Text> | |
</View> |
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
const profileInfoViewed = (fromComponent, profile) => { | |
const { id, name, age, homeLocation } = profile; | |
eventsAPI( | |
'ProfileInfoViewed', | |
fromComponent, | |
{ id, name, age, city: homeLocation.title } | |
); | |
}; |
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
// Based on https://github.com/facebook/relay/blob/master/packages/react-relay/modern/ReactRelayQueryRenderer.js | |
/** | |
* Copyright (c) 2013-present, Facebook, Inc. | |
* All rights reserved. | |
* | |
* This source code is licensed under the BSD-style license found in the | |
* LICENSE file in the root directory of this source tree. An additional grant | |
* of patent rights can be found in the PATENTS file in the same directory. | |
* |
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
# Set variables in .bashrc file | |
# don't forget to change your path correctly! | |
export GOPATH=$HOME/golang | |
export GOROOT=/usr/local/opt/go/libexec | |
export PATH=$PATH:$GOPATH/bin | |
export PATH=$PATH:$GOROOT/bin |