This file contains hidden or 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'; | |
| class Contacts extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| } | |
| handleClick() { | |
| console.log(this); // React Component’ın kendisi | |
| } | |
| render() { |
This file contains hidden or 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'; | |
| class Contacts extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| this.handleClick = this.handleClick.bind(this); | |
| } | |
| handleClick() { | |
| console.log(this); // React Component Kendisi | |
| } |
This file contains hidden or 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'; | |
| var SomeMixin = { | |
| doSomething() { | |
| } | |
| }; | |
| const Contacts = React.createClass({ | |
| mixins: [SomeMixin], | |
| handleClick() { |
This file contains hidden or 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'; | |
| const Contacts = React.createClass({ | |
| propTypes: { | |
| }, | |
| getDefaultProps() { | |
| return { | |
| }; |
This file contains hidden or 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'; | |
| class Contacts extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| } | |
| render() { | |
| return ( | |
| <div></div> | |
| ); |
This file contains hidden or 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 TodoItemsController < ApplicationController | |
| before_action :set_todo_list | |
| before_action :set_todo_item, except: [:create] | |
| def create | |
| @todo_item = @todo_list.todo_items.create(todo_item_params) | |
| redirect_to @todo_list | |
| end | |
| def destroy |
This file contains hidden or 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
| <%= form_for([@todo_list, @todo_list.todo_items.build]) do |f| %> | |
| <%= f.text_field :content, placeholder: "New Todo" %> | |
| <%= f.submit %> | |
| <% end %> |
This file contains hidden or 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
| <p><%= todo_item.content %></p> | |
| <%= link_to "Delete", todo_list_todo_item_path(@todo_list, todo_item.id), method: :delete, data: { confirm: "Are you sure?" } %> |
This file contains hidden or 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
| <p id="notice"><%= notice %></p> | |
| <p> | |
| <strong>Title:</strong> | |
| <%= @todo_list.title %> | |
| </p> | |
| <p> | |
| <strong>Description:</strong> | |
| <%= @todo_list.description %> | |
| </p> | |
| <div id="todo_items_wrapper"> |
This file contains hidden or 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
| Rails.application.routes.draw do | |
| resources :todo_lists do | |
| resources :todo_items do | |
| end | |
| end | |
| root 'todo_lists#index' | |
| end |