Q: How should text be stored in NoSQL? I'm learning to use React.js and Firebase Realtime Database.
I got a simple dropdown like this in my sign-up form:
<label>Why are you moving?</label>
<select>
  <option value="job">I got a new job</option>
  <option value="college">I started at a new college</option>
  <option value="other">Other reasons</option>
</select>

I've been told that I should store a simple descriptive value like "job" in my database. Not the entire string itself.
So my Firebase Realtime Database users object look something like this:
users {
  23982472 {
    ...
    reasonForMoving: 'job',
    ...
  },
  ...
}

This works great.
When I run into problems, is when I try to display the original string on my website.
Right now I'm doing an if/else statement, but this doesn't seem right. Below is an example component.
export function SomeComponent(props) {

  let textToDisplay = '';
  if (this.props.user.reasonForMoving === 'job') {
    textToDisplay = 'I got a new job';
  }
  else if (this.props.user.reasonForMoving === 'college') {
    textToDisplay = 'I started at a new college';
  }

  return (
    ...
    {textToDisplay}
    ...
  )
}

How could this be done in a better way? It seems like a lot of unnecessary code.

A: You could use a map, it's a bit cleaner in code and faster, but also consider using a switch statement.
var textToDisplay = new Map();

textToDisplay.set('job', 'I got a new job');
textToDisplay.set('college','I started at a new college');

export function SomeComponent(props) {
  return (
    ...
    {textToDisplay.get(this.props.user.reasonForMoving)}
    ...
  )
}

With a switch statement, it would look like this
export function SomeComponent(props) {

  let textToDisplay = '';
  switch(this.props.user.reasonForMoving {
    case 'job':
      textToDisplay = 'I got a new job';
      break;
    case 'college':
      textToDisplay = ' I started at a new college';
      break;
  }

  return (
    ...
    {textToDisplay}
    ...
  )
}

