Skip to content

Files

Latest commit

 

History

History
35 lines (22 loc) · 657 Bytes

no-globals-in-created.md

File metadata and controls

35 lines (22 loc) · 657 Bytes

Pattern: Use of window/document in created/beforeCreate

Issue: -

Description

This rule is for preventing using window/document in created/beforeCreate, since created/beforeCreate may be executed in server side in SSR.

Examples of incorrect code for this rule:

export default {
  created() {
    window.foo = 'bar'
  }
}

Examples of correct code for this rule:

export default {
  created() {
    const foo = 'bar'
  }
}

Further Reading