Bosses, can I ask you a question?

const home = r => require.ensure([], () => r(require("../page/home/home")), "home")

what does this r stand for?

Mar.20,2021

const home = function(r){
    return  require.ensure([], () => r(require('../page/home/home')), 'home')
} 
The

arrow function changes this , this r is an argument, here is a function.


r represents the formal parameter of a function, es6 syntax.
is equivalent to function (r) {

require.ensure...

}


parameters


parameters, this place can be parenthesized, but one parameter is optimized by the editor, if there are multiple parameters, it is necessary to add parentheses.

Menu