The problem of how to write export const in vue

in a vue template referenced by a rails project, when reading the code to find data, it is found that there is a data that comes from this

export const activeFile = state => state.openFiles.find(file => file.active) || null;

I don"t understand what the = > symbols are used for many times. I hope some great gods can guide me: -)

< hr >

find a file named state.js in the same folder with a openFIles

.
export default () => ({
  currentProjectId: "",
  currentBranchId: "",
  currentMergeRequestId: "",
  changedFiles: [],
  endpoints: {},
  lastCommitMsg: "",
  lastCommitPath: "",
  loading: false,
  openFiles: [],
  parentTreeUrl: "",
  trees: {},
  projects: {},
  leftPanelCollapsed: false,
  rightPanelCollapsed: false,
  panelResizing: false,
  entries: {},
  viewer: "editor",
  delayViewerUpdated: false,
});
What does the

anonymous function mean? does it directly return such a {} object, or does the state.js file mean to create a constructor called state ?

Mar.18,2021

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
var activeFile = exports.activeFile = function activeFile(state) {
  return state.openFiles.find(function (file) {
    return file.active;
  }) || null;
};

//================
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

exports.default = function () {
  return {
    currentProjectId: '',
    currentBranchId: '',
    currentMergeRequestId: '',
    changedFiles: [],
    endpoints: {},
    lastCommitMsg: '',
    lastCommitPath: '',
    loading: false,
    openFiles: [],
    parentTreeUrl: '',
    trees: {},
    projects: {},
    leftPanelCollapsed: false,
    rightPanelCollapsed: false,
    panelResizing: false,
    entries: {},
    viewer: 'editor',
    delayViewerUpdated: false
  };
};

http://babeljs.io/repl/

Menu