1. Trang chủ
  2. » Tất cả

React 02 introducing jsx integrating external libraries

15 1 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề React Introducing JSX Integrating External Libraries
Trường học University of Example
Chuyên ngành Web Development
Thể loại Lecture Notes
Năm xuất bản 2023
Thành phố Example City
Định dạng
Số trang 15
Dung lượng 872,22 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

React JSX Integrating external libraries React Integrating external l ibraries Content 1 The Goals 2 Downloading required packages 3 Importing Libraries 4 Defining Global CSS 5 Modifying Layout 6 Impo[.]

Trang 1

Integrating external libraries

Trang 2

1 The Goals

2 Downloading required packages

3 Importing Libraries

4 Defining Global CSS

5 Modifying Layout

6 Importing Image

7 Using the Public Folder

Trang 3

1 The Goals

▪ Integrate Bootstrap 5 CSS Framework & Bootstrap icons

Trang 4

2 Downloading required packages

▪ For Installing bootstrap package, in the terminal type:

npm i bootstrap

▪ For Installing bootstrap icons package, in the terminal type:

npm i bootstrap-icons

Trang 5

3 Importing Libraries

▪ Import libraries into src\index.js file

Trang 6

4 Defining Global CSS

▪ Modify src\index.css file

Trang 7

5 Modifying Layout

▪ Copy & Paste content of “ list.html ” file into src\App.js file.

▪ Fix errors of JSX syntaxes

Trang 8

6 Importing Image

Trang 10

7 Using the Public Folder

▪ In the “public\index.html”

Trang 11

▪ In JavaScript code, you can use process.env.PUBLIC_URL

for similar purposes

▪ Keep in mind the downsides of this approach

– None of the files in public folder get post-processed or minified.

– Missing files will not be called at compilation time, and will cause 404 errors for your users.

– Result filenames won’t include content hashes so you’ll need to add query arguments or rename them every time they change.

Trang 12

When to Use the public Folder

▪ Normally we recommend importing stylesheets, images, and

fonts from JavaScript The public folder is useful as a

workaround for a number of less common cases:

– You need a file with a specific name in the build output, such as

manifest.webmanifest

– You have thousands of images and need to dynamically reference their paths.

– You want to include a small script like pace.js outside of the bundled code.

– Some libraries may be incompatible with webpack and you have no other option but to include it as a <script> tag.

Trang 14

▪ Convert HTML into JSX of login.html file

Trang 15

THE END

Ngày đăng: 09/02/2023, 15:34

w