【问题标题】:Meteor Basics: Display Information about specific user in profile pageMeteor Basics:在个人资料页面中显示有关特定用户的信息
【发布时间】:2018-08-04 17:31:46
【问题描述】:

我正在使用 React 和 Meteor。

我有一个允许用户注册的表单。当用户注册时,他/她会输入他们的简历、facebook url 等信息。我使用 Accounts.createUser 进行注册。

当用户访问/user/:userId时,我想显示id为userID的用户信息。

我完全不知道如何将它与 withTracker 结合,以及是否需要 withTracker。

import React, {Component} from 'react';
import {withTracker} from 'react-meteor-data';

class Profile extends Component {

render() {
   return(
       <div>
       <p>Username: </p>
       <p>Bio: </p>
       </div>
    );
  }

}

export default Profile;

我从这里去哪里?我看了这个https://guide.meteor.com/react.html#introduction 但老实说,我不明白。

我想我的问题是: 1. 如何设置 Meteor.users 订阅? (我删除了自动发布和不安全) 2. ....如何将数据传递到配置文件容器中?

【问题讨论】:

    标签: meteor meteor-accounts meteor-react


    【解决方案1】:

    您既不需要订阅Meteor.users 也不需要实现withTracker,因为Meteor.user 已经是一个反应式数据源并且由Meteor.Accounts 管理而不是通过发布/订阅。您应该首先阅读官方Meteor Users Accounts page。我还建议你锻炼Meteor & React simple tutorial

    【讨论】:

      猜你喜欢
      • 2016-05-13
      • 1970-01-01
      • 2016-06-26
      • 2014-11-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-28
      • 1970-01-01
      相关资源
      最近更新 更多