Coder Social home page Coder Social logo

Comments (5)

kevzettler avatar kevzettler commented on September 23, 2024

@RickWong any thoughts or guidance on this?

Seems similar to RickWong/react-transmit#10

Which dosen't look like it was properly resolved

from react-isomorphic-starterkit.

RickWong avatar RickWong commented on September 23, 2024

Hi @kevzettler I would recommend writing a new ConnectHandler component that handles the route, captures the id, then renders <Connect queryParams={{id}} />. It functions as a bridge between React Router and the Transmit component.

Although it's one more component to write, it does separate routing from the Connect component. Doing it like this, enables you to re-use the Connect component somewhere else with another id.

from react-isomorphic-starterkit.

aksrikanth avatar aksrikanth commented on September 23, 2024

Hi @RickWong,

Maybe I'm missing something, but your workaround doesn't seem to work for me. Here is what I did

// Routes
<Route name="user" path="/user/:userId" handler={IdProxy} />

// in IdProxy
render() {
  return <User userId={this.props.params.userId} />
}

// in User (ES6 syntax)
class User extends React.Component {
  render() {
    const user = this.props.user;
    console.log('p: ', this.props);
    return <div/>;
  }
}

export default Transmit.createContainer(User, {
  queries: {
    user(queryParams) {
      console.log('qp: ', queryParams);
      return new Promise((resolve, reject) => {
        resolve(1);
      });
    }
  }
});

This still ends up with the props containing the userId but the queryParams being blank. If I need to load a user in the queries, I cannot without the userId.

from react-isomorphic-starterkit.

RickWong avatar RickWong commented on September 23, 2024

You should render the User like this: <User queryParams={{userId: this.props.params.userId}} />. See this DOCS section HOC PropTypes.

from react-isomorphic-starterkit.

aksrikanth avatar aksrikanth commented on September 23, 2024

Thanks for clarifying :)

from react-isomorphic-starterkit.

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.