Import css ใน React

11 Feb 2018,
Share: 

นอกจากที่เราจะ 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

sql delete

sql delete เป็นคําสั่ง ที่ใช้ในการลบข้อมูลในตาราง โดยสามารถลบข้อมูลตามเงื่อนไข where ที่ผู้ใช้กําหนดDatabase supportMySQL, Microsoft Access, SQL Server, Oracleรูปแบบการใช้

การคูณ-หารจำนวนเต็ม

การคูณ และ หาร ระหว่างจำนวนเต็มสองจำนวน อาศัยเรื่องผลคูณของค่าสัมบูรณ์ของจำนวนทั้งสอง  โดยมีเครื่องหมาย  ดังนี้

Arduino ตอน6 Serial interface ใน Arduino

Serial เป็นรูปแบบการสื่อสารแบบ Asynchronous ชนิดหนึ่งที่ Arduino นํามาใช้ในการสื่อสารกับ Device อื่นๆ เช่น Computer, Arduino, Module Sensor ต่างๆ หรืออุปกรณ์อะไรก็ตามที่รองรับการส่งข้อมูลแบบ Serial สําหรับข้อมูลเพิ่มเติมของการสือสารแบบ Serial อ่านรายละเอียดเพิ่มเติมได้จากบนความนี้ครับ TTL UART RS232 คืออะไร


Copyright © 2019 - 2025 thiti.dev |  v1.54.0 |  Privacy policy | 

Build with ❤️ and Astro.

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