CakePHP 4 - Embedding a Create React App in a View (Development Setup)

Опубликовано: 14 Август 2022
на канале: James McDonald
1,737
39

How to Embed a React App in a CakePHP 4 view template and configure React App and CakePHP 4 for React development

Code: https://github.com/toggenation/embed-...

Video Timings
00:00 Intro
01:12 Creating ReactEmbed Component with bake
02:07 Creating a Controller with bake
03:11 Create an action in Controller
04:14 Create a template file
05:20 Configuring routes
06:30 Install React App using Create React App
08:37 Run a React Production Build
09:19 Deploy React App to CakePHP 4 webroot/
11:30 Sourcing asset-manifest.json to create embed logic
13:00 View CakePHP constants in DebugKit Environment Panel
13:30 Write logic for CSS and JS entrypoints
15:50 Using CakePHP 4 Collection::reduce() method
19:53 Configure CSS and JS script tags in template
20:43 Fix script loading before root div error
20:30 Modify layout to add entrypoint script to custom block
23:12 Fix logo not loading using package.json homepage property
24:50 Configure dev/prod React to request data from CakePHP
29:30 Create dummy api endpoint
31:40 Using ServerRequest::is('ajax')
35:00 Make a fetch request from React
35:58 Setting headers for fetch request
39:20 Adding Cors Middleware
42:17 Stopping useEffect running too many times
46:36 Using npm version patch to version React builds


Смотрите видео CakePHP 4 - Embedding a Create React App in a View (Development Setup) онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь James McDonald 14 Август 2022, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 1,737 раз и оно понравилось 39 людям.