This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import BigComponent from '../components/BigComponent'; | |
class MainComponent extends React.Component { | |
render() { | |
return <BigComponent/>; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HomoHabilis < Human | |
def talk | |
'Agrrr!' | |
end | |
def height | |
'1.29m' | |
end | |
def social_security_number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# parent class (main) | |
class Human | |
def talk | |
'' | |
end | |
def height | |
'' | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// app/javascript/components/MaterialComponentList.js | |
import React from "react"; | |
import PropTypes from "prop-types"; | |
import TextField from '@material-ui/core/TextField'; | |
import Button from '@material-ui/core/Button'; | |
import AppBar from '@material-ui/core/AppBar'; | |
import IconButton from '@material-ui/core/IconButton'; | |
import Toolbar from '@material-ui/core/Toolbar'; | |
import MenuIcon from '@material-ui/icons/Menu'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component, PropTypes } from 'react'; | |
import { Button } from 'react-bootstrap'; | |
import { Form, FieldArray, FormSection, Fields, SubmissionError } from 'redux-form'; | |
import { intlShape, injectIntl, FormattedMessage } from 'react-intl'; | |
import moment from 'moment'; | |
import { isEqual, omit, functions } from 'lodash'; | |
import FlightField from '../fields/flight_field'; | |
import { connectWidgetForm } from './utils'; | |
import messages from './flights_form.messages'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import PropTypes from "prop-types"; | |
import Users from "./Users"; | |
import Pagination from "../Pagination"; // Common pagination component | |
import CreateUserCard from "./CreateUserCard"; | |
import FilterUser from "./FilterUser"; | |
import Loader from '../Loader'; // Common Loader component | |
class Index extends React.Component { | |
constructor(props) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactChartkick, { ColumnChart, PieChart } from 'react-chartkick'; // ReactChartkick library for charts | |
import Chart from 'chart.js'; | |
import NoData from '../NoData'; // When the component don't have any data we create a commom component | |
ReactChartkick.addAdapter(Chart); | |
class AnalyticsChart extends React.Component { | |
constructor(props) { | |
super(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= react_component 'GreetUser', name: 'Ankur' %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Path : app/javascript/components/GreetUser.js | |
import React from "react"; | |
import PropTypes from "prop-types"; | |
class GreetUser extends React.Component { | |
render () { | |
return ( | |
<div> | |
<h1>Hello {this.props.name}, </h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Path: app/views/layouts/application.html.erb --> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>RailsReactWebpacker</title> | |
<%= csrf_meta_tags %> | |
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> | |
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> | |
<!-- Following will make the react components availabe to our layout --> |