-
1
Lifecycle of vueTimes asked 2Official solution
SimpleLifecycle = component ki zindagi ke stages. API call tab jab DOM ready ho — mounted.
created: instance bani,
thisdata, DOM nahi. mounted/onMounted: page pe aa gaya — fetch, Chart.js, setInterval.
updated: data change ke baad. unmounted: cleanup (clearInterval) warna memory leak.Dashboards onMounted isliye: canvas/API tab valid. created mein $el nahi.
Composition: onMounted(() => {}) setup ke andar.
Example
export default { async mounted() { const r = await fetch('/api/venues') this.venues = await r.json() } }Project example: Venues.vue mounted fetch list. Clock component unmounted pe interval clear.
Viva tipcreated: data setup, DOM nahi. mounted/onMounted: $el mil gaya — fetch yahi. Dashboards isliye onMounted use karti hain.
Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet
-
2
Write flask code to show all usersTimes asked 2Official solution
SimpleLive Flask coding: chhota route likho, save, browser/curl se test. Syntax error terminal mein padho.
Example
@app.route('/ping') def ping(): return jsonify(ok=True) @app.route('/even/<int:n>') def even(n): return 'even' if n % 2 == 0 else 'odd'Community answers
No replies yet
No community answers yet
Open My solution to be the first to share yours.
My solution
Not submitted yet