# Scope and Context Lune uses a hierarchical scope system similar to JavaScript's lexical scoping. This allows components to inherit and share data efficiently. ## Scope Inheritance When you nest `lu-scope` directives, a new child scope is created that inherits from the parent scope via JavaScript's prototype chain. This means child scopes can read parent properties, but writing to a property will check the current scope first.
```html

Outer: {{ outer }}

Inner: {{ outer }} {{ inner }}

```
### Property Overriding If a child scope defines a property with the same name as a parent property, it will "shadow" the parent property.
```html

{{ name }}

```
### Updating Parent State When you assign a value to a property in a template, Lune will first check if the property exists on the current scope. If it doesn't, it will walk up the scope chain (prototype chain) and update the property on the first parent scope where it finds it.
```html

{{ count }}

{{ localMsg }} - {{ count }}

```
## Implicit Data Sharing (Scope Inheritance) Since Lune uses prototype-based scope inheritance, any property defined in a parent scope is automatically accessible in all descendant scopes — no special API is needed. ```html

Theme: {{ theme }}

{{ title }} ({{ theme }})

``` For sharing state across multiple independent apps or distant components, see the [Global State](/advanced/global-state) guide using the `reactive()` function.