Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage with React/1.3/react-router #208

Open
sys13 opened this issue Mar 26, 2016 · 7 comments
Open

Usage with React/1.3/react-router #208

sys13 opened this issue Mar 26, 2016 · 7 comments

Comments

@sys13
Copy link

sys13 commented Mar 26, 2016

Here's what I've written so far that I haven't gotten working:

import { Blaze } from 'meteor/blaze'
import { Template } from 'meteor/templating'
import AccountsUI from 'meteor/ian:accounts-ui-bootstrap-3'
import React from 'react'
import ReactDOM from 'react-dom'

export default class AccountsUIWrapper extends React.Component {
  componentDidMount() {
    // Use Meteor Blaze to render login buttons
    this.view = Blaze.render(Template.loginButtons,
      ReactDOM.findDOMNode(this.refs.container))
  }
  componentWillUnmount() {
    // Clean up Blaze view
    Blaze.remove(this.view)
  }
  render() {
    return <span ref="container" />
  }
}

The problem seems to be with this part: Template.loginButtons and probably how I'm importing ian:accounts-ui-bootstrap-3. Any direction would be helpful.

@sys13
Copy link
Author

sys13 commented Mar 26, 2016

I then tried using Template._loginButtons and it would show up. Problem is, when I click on 'Create Account' it reloads the page.

@jacobdr
Copy link

jacobdr commented Mar 28, 2016

I am getting an error "Cannot find module 'meteor/templating'", etc. when I try to mirror your above. Any suggestions?

import { Template } from 'meteor/templating'
import { Blaze } from 'meteor/blaze'

@jacobdr
Copy link

jacobdr commented Mar 28, 2016

For anyone coming at this from Typescript, relevant conversation here

@jacobdr
Copy link

jacobdr commented Mar 28, 2016

So now that I am getting my project to compile, I have the same issue as @sys13 , which I think has to do with the intersection of routing between Blaze/Accounts/React-Router (at least in my case). Will keep posted when a solution comes to bear.

@sys13
Copy link
Author

sys13 commented Mar 29, 2016

@jacobdr Yes, I think react-router is the problem. In fact, any links on my page that are not generated from <Link> lead to a page refresh.

@sys13 sys13 changed the title Usage with React/1.3 Usage with React/1.3/react-router Mar 29, 2016
@scheung38
Copy link

I am also facing the same issue if loginButtons not displaying, so do we remove this package and go back to the acounts-ui package?

@sscaff1
Copy link

sscaff1 commented Jun 16, 2016

import { Blaze } from 'meteor/blaze'
import { Template } from 'meteor/templating'
import AccountsUI from 'meteor/ian:accounts-ui-bootstrap-3'
import React from 'react'
import ReactDOM from 'react-dom'

export default class AccountsUIWrapper extends React.Component {
  componentDidMount() {
    // Use Meteor Blaze to render login buttons
    this.view = Blaze.render(Template._loginButtons,
      ReactDOM.findDOMNode(this.refs.container))
  }
  componentWillUnmount() {
    // Clean up Blaze view
    Blaze.remove(this.view)
  }
  render() {
    return <span ref="container" />
  }
}

In the source code it's defined as _loginButtons. So the above works if you just make that one change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants