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: -)
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
?