[Vuejs]-Vue Composable Functions & Monaco Editor

0👍

This is the case for a ref, which basically is a recipe that allows to pass arbitrary value by reference. Since meditor isn’t supposed to be used prior to useCodeEditor call, it makes more sense to define it inside a composable instead of providing it as an argument:

function useCodeEditor(monaco) {
  const meditor = ref(null);
  ...
  return {
    meditor,
    ...
  }
}

Leave a comment