Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SomeReactComponent extends React.Component {
- constructor(props) {
- super(props);
- ...
- }
- ...
- render() {
- return (
- <span>
- <p>Text that should be displayed to anyone!</p>
- { Meteor.userId() ? (
- <button id="btn">
- This button is only available to logged in users
- </button>
- ) : ""}
- </span>
- );
- }
- }
- import React from "react";
- import {createContainer} from "meteor/react-meteor-data";
- class SomeReactComponent extends React.Component {
- constructor(props) {
- super(props);
- }
- render() {
- return (
- <span>
- <p>Text that should be displayed to anyone!</p>
- { this.props.authenticated ? (
- <button id="btn">
- This button is only available to logged in users
- </button>
- ) : ""}
- </span>
- );
- }
- }
- export default createContainer(()=>{
- return {
- authenticated: Meteor.userId(),
- }
- },SomeReactComponent);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement