admin管理员组

文章数量:1194371

Basically what I'm trying to achieve is send info to the server without quotations e.g Admin instead of "Admin", but as we all know Graphql will throw an error is the variable is not defined or is not in quotations.

Basically what I'm trying to achieve is send info to the server without quotations e.g Admin instead of "Admin", but as we all know Graphql will throw an error is the variable is not defined or is not in quotations.

Share Improve this question asked May 2, 2018 at 12:27 404notBrighton404notBrighton 1701 gold badge3 silver badges11 bronze badges
Add a comment  | 

5 Answers 5

Reset to default 16

we can create a enum like property as below:

const adminEnum = { Admin: 'Admin'};

Hope I got the question right.

you can use enum with typeScript in react-native like describe in the link

sample code is

enum Direction {
  Up = 1,
  Down,
  Left,
  Right,
}

I am using Enum in React as below method is Enum type in GraphQL

const result = apolloclient.mutate({
       mutation: reset_password,
       variables: {
           method: 'EMAIL',
           uuid: opts.uuid
       }
});

enum Pole { East = 1, West, North, South, }

In a seperate class and a file.

  export enum TransportTypeEnum {
      OneWay = 0,
      Return = 1,
    }

import it to other class like

import {TransportTypeEnum} from '../enums/TransportTypeEnum';

本文标签: javascriptHow do i define an enum in react nativeStack Overflow