I am newbie to react js. After couple of hours finally I have some login box code rendering.
But the issue is I am unable to bind click event on button. What i am using.
What i have tried until now is
This is my final code
import React, {Component} from 'react';
import {Page, Card, Button,List,TextField} from '@shopify/polaris';
export default class Login extends React.Component {
constructor() {
super();
this.loginBtbClicked = this.loginBtbClicked.bind(this);
}
loginBtbClicked() {
debugger;
console.log('Hello');
}
render() {
debugger;
/* Some css code has been removed for brevity */
var divStyle = {
width: '500px'
};
return (
<div className="mt-5 mx-auto" style={ divStyle }>
<Card title="Login" subdued sectioned>
<div>
<TextField label="Store Url" type="text" helpText='ex. store.myshopify.com'></TextField>
</div>
<div className="mt-5">
<Button size="large" fullWidth primary onClick = {this.loginBtbClicked} >Login</Button>
</div>
</Card>
</div>
);
}
}
Also help me with best practice in react js for form submit and click event.
Here is the link for github project
https://github.com/little-isaac/shopify-polaris-laravel-test.git
I have changed webpack.mix.js file's path
From
mix.react('resources/assets/js/app.js', 'public/app.js')
to
mix.react('resources/assets/js/app.js', 'js/app.js')
And forget to change public path
mix.setPublicPath('');