Import css ใน React

11 Feb 2018,
Share: 
Vacay banner

นอกจากที่เราจะ import Component อื่นๆเข้ามาใช้งานใน Component ได้ เรายังสามารถที่จะ Import ไฟล์ css เข้ามาใช้งานใน Component ได้อีกด้วย

มาลอง Import กันเลยครับ สร้างไฟล์ Button.css มีเนื้อหาดังนี้

.Button {
  padding: 20px;
}

แล้ว Import แบบนี้ได้เลยครับ ที่ไฟล์ Button.js

import React, { Component } from 'react';
import './Button.css'; // Tell Webpack that Button.js uses these styles

class Button extends Component {
  render() {
    // You can use them as regular CSS styles
    return <div className="Button" />;
  }
}

Suggestion blogs

วิธีปิด update google chrome

Google chrome จะ update อัตโนมัติ แต่ในบ้างครั้งเราไม่ต้องการจะใช้ version ใหม่ เพราะบางที่ version ใหม่อาจจะยังไม่ stable ดังนั้นเราจะมาปิด Google chrome update โดยมีขั้นตอนดังนี้ครับ

วิธีสร้าง Private Repository Github แบบฟรีๆ

สวัสดีครับ ปัจจุบันเว็บที่ให้บริการเกี่ยวกับ version control มีอยู่มากมายหลายเว็บ แต่ที่นิยมกันก็คือ Github Github เปิดให้ใช้บริการฟรีแต่มีข้อจํากัด ไม่สามารจะสร้าง Private Repository ได้ ถ้าใครอยากจะสร้างก็ต้องเสียเงิน ในบทความนี้ผมจะมาแนะนําวิธีใช้งาน  Private Repository กันแบบฟรีๆ วิธีการก็คือ เราจะต้องส่งคําร้องขอใช้งานสําหรับนักศึกษาโดยจะเป็น free plans for educational

ESP8266 ควบคุม i/o ผ่าน web (Access point)

ในบทความนี้ผมจะอธิบายถึงวิธีการทําให้ ESP8266 เป็น Access point ให้อุปกรณ์อุปกรณ์อื่นๆ ที่เชื่อมต่อ wifi ได้ เช่น computer, smart phone ฯลฯ มาเชื่อมต่อกับ SEP8266 แล้วควบคุม i/o ปิด/เปิด LED ผ่านเว็บ ด้วยวิธีส่งข้อมูลผ่าน HTTP_GET เช่น


Copyright © 2019 - 2026 thiti.dev | v1.61.0 | Privacy policy | 

Build with ❤️ and Astro.

Github profile Linkedin profile Instagram X profile Nostr Youtube channel Telegram Email contact วงแหวนเว็บ