Skip to content

Instantly share code, notes, and snippets.

Josh Justice CodingItWrong

Block or report user

Report or block CodingItWrong

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View vue-apollo-update.js
// see https://vue-apollo.netlify.com/guide/apollo/mutations.html
{
addTag() {
// We save the user input in case of an error
const newTag = this.newTag
// We clear it early to give the UI a snappy feel
this.newTag = ''
// Call to the graphql mutation
this.$apollo.mutate({
// Query
View programming-burgers.md

Inspired by this exchange:

@rickhanlonii: My phone autocorrects in-n-out to --no-config it's probably okay

@CodingItWrong: There are a lot of configuration-heavy burger places these days

  • React: You just get the hamburger patty because we want it to be edible by the widest possible variety of people. How can we know in advance how you want to eat it?
  • Preact: less than three calories and just as tasty as React to most people's tastebuds.
  • Vue: we include the pieces that most burgers will need: the patty, the cheese, and the bun. Everyone can add the condiments they already like.
  • Ember: the burger will be more delicious if all of us focus on improving one recipe.
View NewMessageForm.js
import React, { Component } from 'react';
import {
TextInput,
View,
} from 'react-native';
export default class NewMessageForm extends Component {
render() {
return (
<View>
View App.js
import React, { Component } from 'react';
import {
View,
} from 'react-native';
export default class App extends Component {
render() {
return (
<View>
</View>
View package.json.diff
{
...
"detox": {
- "test-runner": "jest"
+ "test-runner": "jest",
+ "configurations": {
+ "ios.sim": {
+ "binaryPath": "bin/Exponent.app",
+ "type": "ios.simulator",
+ "name": "iPhone 8"
View firstTest.spec.js.diff
+const { reloadApp } = require('detox-expo-helpers');
+
describe('Example', () => {
beforeEach(async () => {
- await device.reloadReactNative();
+ await reloadApp();
});
View package.json.diff
"android": "expo start --android",
"ios": "expo start --ios",
+ "test": "node_modules/.bin/jest test/**/*.spec.js",
"eject": "expo eject"
},
...
"jest-expo": "^31.0.0"
},
+ "jest": {
+ "preset": "jest-expo"
View MessageList.js
import React from 'react';
import {
FlatList,
Text,
} from 'react-native';
const MessageList = ({ data }) => (
<FlatList
data={data}
keyExtractor={item => item}
View App.js.diff
import NewMessageForm from './NewMessageForm';
+import MessageList from './MessageList';
...
render() {
+ const { messages } = this.state;
return (
<View>
<NewMessageForm onSend={this.handleSend} />
+ <MessageList data={messages} />
View App.js.diff
export default class App extends Component {
+ state = { messages: [] }
+
handleSend = (newMessage) => {
+ this.setState(state => ({ messages: [newMessage, ...state.messages] }));
}
You can’t perform that action at this time.