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

Unable to use React-Resizer #6

Open
cpandit201 opened this issue Jul 31, 2020 · 1 comment
Open

Unable to use React-Resizer #6

cpandit201 opened this issue Jul 31, 2020 · 1 comment

Comments

@cpandit201
Copy link

cpandit201 commented Jul 31, 2020

I am trying to import react resizer in my project

Can you please provide an example/demo with React v16 Classes / ES6

Issueimporting the Resizer Component gives me an error

Tried to perform on stackblitz giving me same error,
Live Code Demo : https://stackblitz.com/edit/react-resizer-issue

Code

import React, { Component } from 'react';
import { render } from 'react-dom';
import { Resizer } from 'react-resizer'
// let Resizer = require('react-resizer');

class App extends Component {
  constructor() {
    super();
    this.state = {
      name: 'React'
    };
  }
 
  _handleResize = (diff) => {
    return console.log('resizing');
  }
  
  _handleResizeStart = () => {
    return console.log('resize start');
  }
  
  _handleResizeEnd = () => {
    return console.log('resize end');
  }

  render() {
    return (
      <div>
          <Resizer  
          onResizeStart={() => this._handleResizeStart()}
          onResize={() => this._handleResize()}
          onResizeEnd={() => this._handleResizeEnd()}
        />
      </div>
    );
  }
}

render(<App />, document.getElementById('root'));

Unexpected token '<'

image

@an5rag
Copy link

an5rag commented Sep 30, 2020

You need to change the file extension to use react (from js -> jsx)

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

2 participants