Code Monkey home page Code Monkey logo

Comments (6)

paf31 avatar paf31 commented on June 2, 2024

Thermite doesn't do much with props, only state. Right now, you can read props in render, or convert to a React component spec, and do stuff with the props there before finally converting to a component class.

The tricky thing is that props aren't as nicely composable as the state from Thermite's point of view, in the sense that the parent is responsible for updating props, not the current component. On the other hand, we can share parts of state between parent and child easily.

from purescript-thermite.

AlexeyRaga avatar AlexeyRaga commented on June 2, 2024

Yes, I see that I could manage it through state, but React itself is moving more and more away from the concept of stateful components, and the current version even introduces a new syntax:

var Aquarium = (props) => {
  var fish = getFish(props.species);
  return <Tank>{fish}</Tank>;
};

which is actually a function from props to component, so I thought that maybe there is a way to embrace props rather than fighting them...

The fact that the parent is responsible for providing props and not the current component corresponds to the fact that the caller is responsible for providing function arguments and not the function itself. Not sure if it should be a problem for composition.

from purescript-thermite.

paf31 avatar paf31 commented on June 2, 2024

This is probably relevant: purescript-contrib/purescript-react#52

from purescript-thermite.

AlexeyRaga avatar AlexeyRaga commented on June 2, 2024

Oh, thank you! I will definitely check it out. Does it still work with the latest purescript-thermite?

from purescript-thermite.

paf31 avatar paf31 commented on June 2, 2024

Yes, I've updated Thermite to use the latest version.

from purescript-thermite.

AlexeyRaga avatar AlexeyRaga commented on June 2, 2024

Thanks a lot! I'll close this issue and give it a go.

from purescript-thermite.

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.