Search code examples
javascriptreact-nativeenumsgraphql

How do i define an enum in react native


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.


Solution

  • we can create a enum like property as below:

    const adminEnum = { Admin: 'Admin'};
    

    Hope I got the question right.