Adding React to a fresh Laravel installation

- Posted in Programming by

While there are many starter kits for Laravel giving us many options from React or Vue or Livewire etc, I do not prefer using the inertia js and prefer a more traditional React front end SPA. This post documents the steps needed for adding support for React to a fresh Laravel installation (tested on v12).

Create the laravel project

composer create-project "laravel/laravel" web

This command will create a fresh Laravel application in the web folder. Then cd into the web folder and install the following packages:

npm install --save-dev react react-dom @vitejs/plugin-react

Open up the vite.config.js file and add the react plugin. Once done the file should look something similar to the following:

import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import tailwindcss from '@tailwindcss/vite';
import react from '@vitejs/plugin-react';

export default defineConfig({
    plugins: [
        react(),
        laravel({
            input: ['resources/css/app.css', 'resources/js/app.jsx'],
            refresh: true,
        }),
        tailwindcss(),
    ],
});

The key change is the adding of the @vitejs/plugin-react and using the .jsx extension in the input argument to the laravel plugin.

Now in the welcome.blade.php add the following line above the @vite line: @viteReactRefresh

Now change the @vite line to the following: @vite(['resources/css/app.css', 'resources/js/app.jsx'])

The change beingusing of the .jsx extension. Now rename the resources/js/app.js file to resources/js/app.jsx Open the app.jsx file and add the following code below:

import './bootstrap';
import React from "react";
import ReactDOM from 'react-dom/client';

const e=document.getElementById('root');
if(e){
ReactDOM.createRoot(e).render(     


Hello from react!
); }

In the welcome.blade.php add a div with the id "root"



Now run the php dev server by running the command composer run dev

If all works well, the welcome page should show the message Hello from react!

Numerology

- Posted in Spirituality by

Numbers have great meaning and significance. Age old beliefs about certain numbers being good or cursed is there in all cultures. Be it the infamous number 13 or the lucky 7. The practise of giving odd number values such as 101 or 501 in gifts or in donation is prevalent in India. Each culture, region has its own interpretation on what is auspicious and what is to be avoided.

The science of deriving meaning from numbers – the numerology has several interpreters hence several sets of meanings. What one teacher or a branch considers the meaning of a number say 5 will not certainly be the meaning given to it by another. We have over the years put so much effort in to making up meanings in these great concept of numbers that many believe that the entire personality, future events, past actions can be derived from the date of your birth or license number of your vehicle or your mobile phone number.

While for those who are truly gifted in reading the universe even these could be a handle to further their understanding, however trying to build a science around the numerology is somewhat ingenuous.

For example you might say the number one denotes great personal power, this number means that you don’t listen to random people, instead you have your own individuality. All this is well. But putting that in practise, saying that everybody born on the 1st, 10th, 19th or on 28th of a month belongs to number 1 and hence carry these attributes is taking things too far and simplifying the great mystery and variety of life too much.

Today is 1st of March. However according to several Indian calendars in use for tens of centuries today is a totally different date. So why would today belong to the number 1?

Numbers as concepts have great value and meanings. But using the dates or mobile numbers to do prediction is not suitable as far as I am concern. The practise of prashna jyotisha or kavadi prashna will give far greater results if done by an intuitive and knowledgeable person.

To wrap this up, here is my interpretation of few numbers (thought up in a few minutes).

One is myself. This denotes an individual and the universe. two is the other. Here duality enters. I’m not the only existence, there is another. The number 3 denotes our first rival and our first teammate. The number 4 brings balance.

What do you think the number 5 means?

The trinity of existence

- Posted in Spirituality by

The trinity Brahma, Vishnu and Shiva in Hinduism /Sanatana dharma represents the three core processes of nature. Creation, sustenance and destruction respectively. These 3 male deity (for lack of a better word) are completed by their three female counterparts – Saraswati, Lakshmi and Shakti.

The feminine provides the raw energy, the capability of learning and wisdom, luck and wealth and strength. Their male counterpart shapes it, directs it. Similar to yin and yang, the male (yang) is action and function whereas the yin (the female) is the raw potential or the essence.

Brahma and Saraswati

For creation, knowledge is essential – Brahma cannot create without the knowledge and skill of Saraswati.

Vishnu and Lakshmi

For sustenance you need wealth, resources, luck and so on. The lord of maintenance and protection cannot function without the Lakshmi’s blessing.

Shiva and Shakti

To destroy you need power. To break creation in to raw energy Shakti is needed. For creation, you need to destroy.

The circular nature of existence

Everything comes in to being (Brahma), lives for a while (Vishnu) and dissolves again (Shiva). There is no Brahma without Shiva and no Vishnu without Brahma and no Shiva without either of the other two. The creation flows through this cycle in all the shapes and sizes be it at the level of cosmos or at the level of individual atoms. Whether it is a thought, man made product all the creation has these three stages of existence.