Using else if only when specifically required. Try to see if only else could solve it.
Think of what types the function returns, do they satisfy your needs? Otherwise, coerce them.
| import React from "react"; | |
| import { graphql } from "gatsby"; | |
| import Img from "gatsby-image"; | |
| function photos({ data }) { | |
| console.log(data.images.nodes); | |
| return ( | |
| <div> | |
| <h1>All My Photos</h1> |
| import React from "react"; | |
| import styled, { keyframes } from "styled-components"; | |
| const slide = keyframes` | |
| from { | |
| transform: translateY(0); | |
| } | |
| to { | |
| transform: translateY(5px); |
| { | |
| "useTabs": false, // Indent lines with tabs instead of spaces. | |
| "printWidth": 80, // Specify the length of line that the printer will wrap on. | |
| "tabWidth": 2, // Specify the number of spaces per indentation-level. | |
| "singleQuote": false, // Use single quotes instead of double quotes. | |
| /** | |
| * Print trailing commas wherever possible. | |
| * Valid options: | |
| * - "none" - no trailing commas | |
| * - "es5" - trailing commas where valid in ES5 (objects, arrays, etc) |
| const mongoose = require("mongoose"); | |
| const Schema = mongoose.Schema; | |
| // Create Schema | |
| const PostSchema = new Schema({ | |
| user: { | |
| type: Schema.Types.ObjectId, | |
| ref: "users", | |
| }, | |
| text: { |
| const Validator = require("validator"); | |
| const isEmpty = require("./is-empty"); | |
| // we cant use isEmpty from validator pkg as it needs its param to be a string | |
| // data is req.body | |
| module.exports = function validateRegisterInput(data) { | |
| let errors = {}; | |
| data.name = isEmpty(data.name) ? "" : data.name; | |
| data.email = isEmpty(data.email) ? "" : data.email; |
| // Creating a passport strategy | |
| const JwtStrategy = require("passport-jwt").Strategy; | |
| const ExtractJwt = require("passport-jwt").ExtractJwt; | |
| const mongoose = require("mongoose"); | |
| // Get the user model | |
| const User = mongoose.model("users"); | |
| const keys = require("../config/keys"); | |
| const opts = {}; |
ERROR #85923 GRAPHQL
There was an error in your GraphQL query:
Cannot query field "allExampleCode" on type "Query".
If you don't expect "allExampleCode" to exist on the type "Query" it is most likely a typo.
However, if you expect "allExampleCode" to exist there are a couple of solutions to common problems:| import React, { Component, createRef } from "react"; | |
| class Input extends Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { | |
| name: "", | |
| copyMsg: "Copy to Clipboard", | |
| isCopied: false, | |
| }; |