Migrate JavaScript
Move JavaScript code from your client-side controller, helper, and renderer to the single JavaScript file in a Lightning web component.
A client-side controller in an Aura component is a JavaScript object in object-literal notation containing a map of name-value pairs. A JavaScript file in Lightning web components is an ES6 module so you're using standard JavaScript rather than the proprietary format used in Aura components.
This is not a line-by-line conversion, and it's a good opportunity to revisit your component's design.
To share JavaScript code between Lightning web components and Aura components, put the code in an ES6 module. For more information, see Share JavaScript Code Between LWC and Aura.
See Also
- Component JavaScript File
- Trailhead: Modern JavaScript Development: Learn about JavaScript ES6 features and what you can do with them