Code Monkey home page Code Monkey logo

Comments (2)

msaraiva avatar msaraiva commented on July 30, 2024 1

Hi @mathewdgardner!

<slot/> is translated to the anonymous function @inner_content.() and as such, can only access variables (consequently the context) that belong to the same scope where it was defined. So you need to either move Parent.ContextProvider out of Parent and place it explicitly as a parent of Child or pass whatever you need using <slot :props={{ some_prop: value }}/> and then retrieve it using :let={{ some_prop: var }}.

I'm currently working on the documentation of the slots API, where I explain how :props and :let works. I should release the new docs by the end of the week. In the meantime, in case you need to see how it works, you can take a look at slot_test.exs. There are many tests using :props and :let.

from surface.

mathewdgardner avatar mathewdgardner commented on July 30, 2024

Thank you @msaraiva for your clarification.

I can move the context into the parent but I need the child to be able to get updates to it. Is there any mechanism for a child getting context from the parent updating or re-rendering?

from surface.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.