The question about hooks
See original GitHub issueI’ve just started using nuxt-property-decorator (I’m new with vue-property-decorator as well) and I would like to ask how you remember all the hooks. It’s totally unclear (on the first glance) why some class methods are hooks and the other are just methods. For example,
@Component
export default class ErrorLayout extends Vue {
@Prop({ type: Object, default: null }) readonly error!: NuxtError
test() {
return 'test'
}
layout() {
return 'empty'
}
}
Layout is a hook and placed in the root scope while test is a method and placed inside methods. Isn’t it more intuitive to consider all the class’s methods as vue methods and have something like @AtRoot
decorator if anything has to be placed on the root level?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8
Top Results From Across the Web
React Hooks Interview Questions | Backbencher.dev
Question : What are hooks in React? Answer: Hooks are a new feature added in React v16.8. It allows to use all React...
Read more >27 Advanced React Hooks Interview Questions (ANSWERED ...
Q1: What are React Hooks? ... Hooks are a new addition in React 16.8. They let you use state and other React features...
Read more >How to Write a Hook | Writing Studio
A question hook is when you ask the reader something that they can visualize and try to think of in their own minds....
Read more >Top 10 Interview Questions Related To React Hooks
Top 10 Interview Questions Related To React Hooks · Q1. What Are React Hooks? · Q2. What is the primary benefit of Hooks?...
Read more >Hooks FAQ - React
This page answers some of the frequently asked questions about Hooks. Adoption Strategy ... Do Hooks replace render props and higher-order components?
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
maybe all hooks function should be implemented on base
Vue
class, with empty body and proper typing? by this it should be much less possible to declare some random properties / functions with same names. and in case of migration - TypeScript would warn the user that the properties are in conflict.Thanks @wiktor-obrebski, indeed we need to sort this out. If anyone has any suggestions, please.