Moodle ReactJS - gives you ability to use ReactJS inside any moodle page.

Overview

moodle-local_reactjs

Moodle ReactJS - gives you ability to use ReactJS inside any moodle page.

Note for devs:

You'll need to set up npm dependencies directly at the react directory.

E.g:

your_moodle_dir/local/reactjs/react

Run command in your module folder

npm install

How to compile multiple modules for different pages

Current webpack.config.js isn't able to split code into modules. To implement this feature you have to add different entry points to your config file

How to include moodle JS libraries to your React App

webpack.config.js connects moodle JS libraries, so you can use them in your code following this example:

import React, { useState } from 'react';
import * as Str from 'core/str';

function App() {
    const [title, setTitle] = useState('');

    const getTitle = async (key: string) => setTitle(await Str.get_string(key));
    getTitle('courses');
    
    return (
        <div className="App">
            {title}
        </div>
    );
}

export default App;

Also, you need to add required libraries to the index.d.ts file so TypeScript won't give you any errors during build process:

declare module 'core/str' {
    const call: any;
    export default call;
}

How to connect your React App to moodle page

This can be done via basic moodle js file connection. E.g:

require_once(__DIR__ . '/../../config.php');
require_once('lib.php');

global $CFG, $DB;

echo $OUTPUT->header();

$PAGE->requires->js_call_amd('local_reactjs/app-lazy', 'init');

echo '<div id="your-app-render-id"></div>';

echo $OUTPUT->footer();
You might also like...
Moodle - the world's open source learning platform

.-..-. _____ | || | /____/-.---_ .---. .---. .-.| || | .---. | | _ _ |/ _ \/ _ \/ _ || |/ __ \ * | | |

Stack Coderunner para Moodle

Stack Coderunner para Moodle Este projeto inclui um stack de ferramentas úteis para utilização do plugin de tipo de questão Moodle chamado Coderunner.

A webshell plugin and interactive shell for pentesting a Moodle instance.
A webshell plugin and interactive shell for pentesting a Moodle instance.

Moodle webshell plugin for RCE A webshell plugin and interactive shell for pentesting a Moodle instance. Features Webshell plugin for Moodle. Execute

An Elasticsearch engine plugin for Moodle's Global Search
An Elasticsearch engine plugin for Moodle's Global Search

Moodle Global Search - Elasticsearch Backend This plugin allows Moodle to use Elasticsearch as the search engine for Moodle's Global Search. The follo

Moodle activity plugin for embedding content from other websites in a GDPR-compliant way

ICON activate external content What is it? This plugin is for when you want to include GDPR-compliant embeddings of content from external platforms su

Musicoker is a music player made by Laravel & Reactjs
Musicoker is a music player made by Laravel & Reactjs

Musicoker | Music Player Music player created with Laravel 8 and React 17.0.2 ReactJs Laravel MySQL Used Packages: Sanctum Getid3 Bootstrap React Rout

It's MX Player API gives All Content in JSON format

💞 MXPlayer API 🎵 🍻 MXPlayer API Can get Streaming URLs and Other Data in JSON Format From mxplayer.in links for Streaming 👑 How to Use : 🔐 Method

A Frankenstein's monster: Kirby inside of Laravel.

A Kirby-Laravel Starter Kit This is an experimental starter kit for using Kirby within Laravel (a little like Statamic). In my limited experience it r

Owner
SmartApp
SmartApp is a full-service digital agency, providing design, development and online marketing services.
SmartApp
Michael Pratt 307 Dec 23, 2022
Track any ip address with IP-Tracer. IP-Tracer is developed for Linux and Termux. you can retrieve any ip address information using IP-Tracer.

IP-Tracer is used to track an ip address. IP-Tracer is developed for Termux and Linux based systems. you can easily retrieve ip address information using IP-Tracer. IP-Tracer use ip-api to track ip address.

Rajkumar Dusad 1.2k Jan 4, 2023
Minimalist PHP frame for Core-Library, for Developing PHP application that gives you the full control of your application.

LazyPHP lightweight Pre-Made Frame for Core-library Install Run the below command in your terminal $ composer create-project ryzen/lazyphp my-first-pr

Ry-Zen 7 Aug 21, 2022
Core - ownCloud gives you freedom and control over your own data.

ownCloud Core ownCloud gives you freedom and control over your own data. A personal cloud which runs on your own server. Why is this so awesome? ?? Ac

ownCloud 7.9k Jan 4, 2023
PHP Meminfo is a PHP extension that gives you insights on the PHP memory content

MEMINFO PHP Meminfo is a PHP extension that gives you insights on the PHP memory content. Its main goal is to help you understand memory leaks: by loo

Benoit Jacquemont 994 Dec 29, 2022
The package provides the ability to write logs into the database synchronously or asynchronously, along with other logging channels.

Laravel database log channel The package provides the ability to write logs into the database synchronously or asynchronously, along with other loggin

Jarosław Goszowski 18 Nov 28, 2022
This packages enables the ability to serve file streams in a smart way

A blade component for easy image manipulation Want to serve private hosted images without the need to code your own logic ? Want to resize your images

Dieter Coopman 205 Dec 19, 2022
Provides the ability to notify developers of error logs via email or SMS.

?? Dev Notify Plugin ?? Requires OctoberCMS 2.0 ✨ What does this plugin do? Provides the ability to notify developers of error logs via email or SMS.

Albright Labs 1 Mar 28, 2022
A non-intrusive support form that can be displayed on any page

A non-intrusive support bubble that can be displayed on any page Using this package you can quickly add a chat bubble that opens a support form on any

Spatie 288 Dec 28, 2022
Moodle plugin to limit the access to course content according to the user level in Block Game.

Moodle plugin to limit the access to course content according to the user level in Block Game.

null 4 Oct 18, 2022