react基础

react中文教程

React环境搭建

antd使用

https://ant-design.antgroup.com/components/overview-cn

  • 全局安装 npm install antd-init -g
  • antd-init
  • npm install antd –save

React

在你的组件显示在屏幕上之前,它们必须由 React 进行渲染。理解这个过程中的步骤有助于你思考你的代码如何执行并解释其行为。

想象一下,你的组件是厨房里的厨师,用食材制作出美味的菜肴。在这个场景中,React 是服务员,负责提出顾客的要求,并给顾客上菜。这个请求和服务 UI 的过程有三个步骤:

  • 触发渲染(将食客的订单送到厨房)
  • 渲染组件(在厨房准备订单)
  • 提交到 DOM(将订单送到桌前)

作为快照的状态

  • 与普通 JavaScript 变量不同,React 状态的行为更像一个快照。设置它并不改变你已有的状态变量,而是触发一次重新渲染。这在一开始可能会让人感到惊讶!
1
2
3
4
5
6
7
console.log(score);  // 0
setScore(score + 1); // setScore(0 + 1);
console.log(score); // 0
setScore(score + 1); // setScore(0 + 1);
console.log(score); // 0
setScore(score + 1); // setScore(0 + 1);
console.log(score); // 0

更新数组

避免使用 (会改变原始数组) 推荐使用 (会返回一个新数组)
添加元素 push,unshift concat,[…arr] 展开语法(例子)
删除元素 pop,shift,splice filter,slice(例子)
替换元素 splice,arr[i] = … 赋值 map(例子)
排序 reverse,sort 先将数组复制一份(例子)

Context使用场景

ref 和 state 的不同之处

ref state
useRef(initialValue)返回 { current: initialValue } useState(initialValue) 返回 state 变量的当前值和一个 state 设置函数 ( [value, setValue])
更改时不会触发重新渲染 更改时触发重新渲染。
可变 —— 你可以在渲染过程之外修改和更新 current 的值。 “不可变” —— 你必须使用 state 设置函数来修改 state 变量,从而排队重新渲染。
你不应在渲染期间读取(或写入) current 值。 你可以随时读取 state。但是,每次渲染都有自己不变的 state 快照。

Effect

1
2
3
4
5
const [count, setCount] = useState(0);
useEffect(() => {
setCount(count + 1);
});

爱因斯坦与佛陀

转载自: https://www.colombotelegraph.com/index.php/einstein-and-buddha-convergence-between-science-and-eastern-philosophy/

“Buddhism has the characteristics of what would be expected in a cosmic religion for the future: It transcends a personal God avoids dogmas and theology; it covers both the natural and spiritual; and it is based on a religious sense aspiring from the experience of all things, natural and spiritual, as a meaningful unity.

“If there is any religion that would cope with modern scientific needs it would be Buddhism. . (Albert Einstein)

Albert Einstein is possibly the greatest scientist mankind has ever produced. His general theory of relatively created a revolutionary change on how scientists have viewed the world. He discovered that time and space is always related to the observer. His famous equation E=MC2 revealed that matter and energy are interchangeable forms of same substance. Einstein being a genius did not confine his interest only on science. The views he has expressed on Religion, philosophy and politics indicates that he was a great thinker who tried to bridge the gap between science and philosophy or religion. Buddha gave us a great teaching which would lead to tap the maximum potential of the mind which will eventually lead to the understanding of everything happening around us and finally to liberate from the cycle of Sansara (Cycle of Birth and death). The difference between Einstein and Buddha is that while former was keen in finding answers to the phenomenon of outside world, Buddha used his own powers of observation within his mind (introspection), intellect and reasoning, grounded in reality, to guide him to his enlightenment. Both Buddha and Einstein did their research on a scientific basis. Buddha advised his followers NOT to accept what he was teaching them at face value or to take his beliefs “on faith.” Rather, he counseled them to test his theories for themselves, and if they didn’t prove true, then reject them. Buddha found what he was looking for. Einstein after all his discoveries has to admit mankind does not have the wisdom to understand the all the mysteries of the nature. The purpose of this article is to examine the relevancy of some of Einstein’s statement to Buddhist teachings and also to present Einstein’s view about the religion.

Einstein upheld the need for morality and rightness of the mankind. But he believed that morality should not come from fear or punishment expected from ‘God” or any other force. He said – A man’s ethical behavior should be based effectually on sympathy, education, and social ties and needs; no religious basis is necessary. Man would indeed be in a poor way if he had to be restrained by fear of punishment and hope of reward after death. If people are good only because they fear punishment, and hope for reward, then we are a sorry lot indeed- (Albert Einstein, “Religion and Science”, New York Times Magazine, 9 November 1930

Einstein denied the existence of a personal God but he could not provide an answer behind the beauty and methodical way universe has been formed. This he expressed in following way.

I do not believe in a personal God and I have never denied this but have expressed it clearly. If something is in me which can be called religious then it is the unbounded admiration for the structure of the world so far as our science can reveal it. I believe in Spinoza’s God who reveals himself in the orderly harmony of what exists, not in a God who concerns himself with the fates and actions of human beings. (Albert Einstein, 1954)

Who is this Spinoza’s God Einstein is refereeing to? Spinoza was a Dutch philosopher, who claimed that God is nothing but the NATURE According to Spinoza there is mass, energy, atoms, molecules, life, thought, people, societies, galaxies and perhaps even multiple universes but there is nothing outside nature, including spiritual visions and other phenomena we don’t yet understand. If they exist, they are part of nature. According to Buddhism there are five natural laws at work in the cosmos that cause things to happen, called the Five Niyamas. . Karma is only one of these factors. Present circumstances are the result of countless factors that are always in flux. There is no single cause that makes everything to be the way it is

The following statement clearly indicates that although Einstein rejected God he is not an atheist.

I have repeatedly said that in my opinion the idea of a personal God is a childlike one, but I do not share the crusading spirit of the professional atheist whose fervor is mostly due to a painful act of liberation from the fetters of religious indoctrination received in youth. I prefer an attitude of humility corresponding to the weakness of our intellectual understanding of nature and of our own being.

Buddha rejected the traditional Hindu view that world was a creation by God and also rejected materialism of atheists. He became the first philosopher to reject the belief ‘Soul’ is a permanent entity. It appears that Einstein accepted both these positions. In the above statement, Einstein was humble enough to admit the inadequacy or limitations of his knowledge to find the answer to the ‘mysteries’ of the world.

Just examine following statement of Einstein

“A human being is part of the whole, called by us ‘Universe’; a part limited in time and space. He experiences himself, his thoughts and feelings as something separated from the rest – a kind of optical delusion of his consciousness. This delusion is a kind of prison for us, restricting us to our personal desires and affection for a few persons nearest us. Our task must be to free ourselves from this prison by widening our circle of compassion to embrace all living creatures and the whole nature in its beauty. Nobody is able to achieve this completely but striving for such achievement is, in itself, a part of the liberation and a foundation for inner security.”

Physical concepts are free creations of the human mind, and are not, however it may seem, uniquely determined by the external world. -Einstein

It is amazing to know that Buddha, 2500 years back, expressed almost the same view in different words “All such notions as causation, succession, atoms, primary elements…are all figments of the imagination and manifestations of the mind. – -Buddha

According to Buddha, Self is not a rational concept. Self is only an emotional feeling- Therefore consciousness is an illusion and the feeling of ‘Self” is only an activity of brain. People live unconsciously in dream like state believing their existence. As a result they become attached to names and forms, not realising that they have no more basis than the activities of the mind itself. Buddha declared that due to this error in view, liberation of the mankind would be blocked. Buddha called it ignorance what Einstein described it as a delusion of consciousness. Buddha’s solution to free us from prison is by developing and purification of mind, following a clear path towards it (8 FP and 4NT). Buddha’s path also involves widening selfless compassion to all human beings. According to Buddha the attachment (Lust) brings suffering and would also prevent one from escaping the prison. Einstein says that this prison restricts our affection only to our loved ones (Becoming Selfish). He suggests that to free from the prison the compassion should embrace all living creatures. (It is interesting Einstein did not confine compassion only to human beings)

Einstein’s attempt to discover the mystery of the world can be seen from this statement.

The most beautiful and most profound experience is the sensation of the mystical. It is the sower of all true science. He to whom this emotion is a stranger, who can no longer wonder and stand rapt in awe, is as good as dead. To know that what is impenetrable to us really exists, manifesting itself as the highest wisdom and the most radiant beauty which our dull faculties can comprehend only in their primitive forms – this knowledge, this feeling is at the center of true religiousness. (Albert Einstein – The Merging of Spirit and Science)

Here again Einstein admits that human mind cannot comprehend all the mysteries of the world. But he admired the beauty and methodical way nature operates it. He admitted the answer comes with more wisdom and he also termed it as true religiousness. Buddha’s approach for what Einstein has been looking could be evident from following interesting Dialogue between Buddha and one of his disciples.

“Most respected one; can you please tell me what the size of the universe is?”

Buddha replied:

“Will the size of the universe help you end suffering?”

The disciple answered:

“No, most respected one”

Buddha then answered:

“So why are you asking questions of little importance and not ask questions on the ending of suffering?

Buddhism avoids speculative metaphysical questions as irrelevant distractions. According to Buddhism, nothing happens without a cause; therefore the universe is infinite with no real beginning. However, it does run in cycles, so there can be a beginning for each particular era.

This Parable of the arrow has often been used to illustrate the Buddha’s teachings that “practitioners who concern themselves with the origins of the universe and other topics are missing the point of religious practice.”

Suppose someone was hit by a poisoned arrow and his friends and relatives found a doctor able to remove the arrow. If this man were to say, ‘I will not have this arrow taken out until I know whether the person who had shot it was a priest, a prince or a merchant, his name and his family. I will not have it taken out until I know what kind of bow was used and whether the arrowhead was an ordinary one or an iron one.’ That person would die before all these things are ever known to

In short, work on being here (The Present moment) before you consider why or how you came to be here.

Once Bertrand Russell explained why he accepts the Buddhist view on origin of the world. -” Among the founders of all religions in this world, I respect only one man — the Buddha. The main reason was that the Buddha did not make statements regarding the origin of the world. The Buddha was the only teacher who realised the true nature of the world.” (Bertrand Russell)

It is interesting to note that Modern scientists and psychologists pay great attention to research on brain and mind. Buddhist mediation methods of loving kindness, breathing mediation and mindfulness are widely used in western medicine and psychology. It would be great if more scientists like Einstein come forward to bridge the gap between the science and eastern philosophy in future.

epoll的水平触发和边缘触发模式

参考: https://cloud.tencent.com/developer/article/1636224

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
/**
* 验证epoll的LT与ET模式的区别, epoll_server.cpp
* zhangyl 2019.04.01
*/
#include<sys/types.h>
#include<sys/socket.h>
#include<arpa/inet.h>
#include<unistd.h>
#include<fcntl.h>
#include<sys/epoll.h>
#include<poll.h>
#include<iostream>
#include<string.h>
#include<vector>
#include<errno.h>
#include<iostream>


// 测试ET模式(边缘触发模式)
#define TEST_ET_MODE


int main()
{
//创建一个监听socket
int listenfd = socket(AF_INET, SOCK_STREAM, 0);
if (listenfd == -1)
{
std::cout << "create listen socket error" << std::endl;
return -1;
}

//设置重用ip地址和端口号
int on = 1;
setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, (char*)& on, sizeof(on));
setsockopt(listenfd, SOL_SOCKET, SO_REUSEPORT, (char*)& on, sizeof(on));


//将监听socker设置为非阻塞的
int oldSocketFlag = fcntl(listenfd, F_GETFL, 0);
int newSocketFlag = oldSocketFlag | O_NONBLOCK;
if (fcntl(listenfd, F_SETFL, newSocketFlag) == -1)
{
close(listenfd);
std::cout << "set listenfd to nonblock error" << std::endl;
return -1;
}

//初始化服务器地址
struct sockaddr_in bindaddr;
bindaddr.sin_family = AF_INET;
bindaddr.sin_addr.s_addr = htonl(INADDR_ANY);
bindaddr.sin_port = htons(3000);

if (bind(listenfd, (struct sockaddr*) & bindaddr, sizeof(bindaddr)) == -1)
{
std::cout << "bind listen socker error." << std::endl;
close(listenfd);
return -1;
}

//启动监听
if (listen(listenfd, SOMAXCONN) == -1)
{
std::cout << "listen error." << std::endl;
close(listenfd);
return -1;
}


//创建epollfd
int epollfd = epoll_create(1);
if (epollfd == -1)
{
std::cout << "create epollfd error." << std::endl;
close(listenfd);
return -1;
}

epoll_event listen_fd_event;
listen_fd_event.data.fd = listenfd;
listen_fd_event.events = EPOLLIN;
//取消注释掉这一行,则使用ET模式
#ifdef TEST_ET_MODE
listen_fd_event.events |= EPOLLET;
#endif

//将监听sokcet绑定到epollfd上去
if (epoll_ctl(epollfd, EPOLL_CTL_ADD, listenfd, &listen_fd_event) == -1)
{
std::cout << "epoll_ctl error" << std::endl;
close(listenfd);
return -1;
}

int n;
while (true)
{
epoll_event epoll_events[1024];
n = epoll_wait(epollfd, epoll_events, 1024, 1000);
if (n < 0)
{
//被信号中断
if (errno == EINTR)
continue;

//出错,退出
break;
}
else if (n == 0)
{
//超时,继续
continue;
}
for (size_t i = 0; i < n; ++i)
{
//事件可读
if (epoll_events[i].events & EPOLLIN)
{
if (epoll_events[i].data.fd == listenfd)
{
//侦听socket,接受新连接
struct sockaddr_in clientaddr;
socklen_t clientaddrlen = sizeof(clientaddr);
int clientfd = accept(listenfd, (struct sockaddr*) & clientaddr, &clientaddrlen);
if (clientfd != -1)
{
int oldSocketFlag = fcntl(clientfd, F_GETFL, 0);
int newSocketFlag = oldSocketFlag | O_NONBLOCK;
if (fcntl(clientfd, F_SETFD, newSocketFlag) == -1)
{
close(clientfd);
std::cout << "set clientfd to nonblocking error." << std::endl;
}
else
{
epoll_event client_fd_event;
client_fd_event.data.fd = clientfd;
//同时侦听新来连接socket的读和写时间
client_fd_event.events = EPOLLIN | EPOLLOUT;
//取消注释这一行,则使用ET模式
client_fd_event.events |= EPOLLET;
if (epoll_ctl(epollfd, EPOLL_CTL_ADD, clientfd, &client_fd_event) != -1)
{
std::cout << "new client accepted,clientfd: " << clientfd << std::endl;
}
else
{
std::cout << "add client fd to epollfd error" << std::endl;
close(clientfd);
}
}
}
}
else
{
std::cout << "client fd: " << epoll_events[i].data.fd << " recv data." << std::endl;
//普通clientfd
char recvbuf[1024] = { 0 };

#ifdef TEST_ET_MODE
// 边缘出发,必须一次性收完
int m = 0;
do
{
m = recv(epoll_events[i].data.fd, recvbuf, 1, 0 );
if(m > 0)
{
std::cout << "recv from client:" << epoll_events[i].data.fd << ", " << recvbuf << std::endl;
}
bzero(recvbuf, sizeof(recvbuf));
}while(m > 0);
#else
// 水平触发,每次只收一个字节, 不影响
int m = recv(epoll_events[i].data.fd, recvbuf, 1, 0);
#endif
if (m == 0)
{
//对端关闭了连接,从epollfd上移除clientfd
if (epoll_ctl(epollfd, EPOLL_CTL_DEL, epoll_events[i].data.fd, NULL) != -1)
{
std::cout << "client disconnected,clientfd:" << epoll_events[i].data.fd << std::endl;
}
close(epoll_events[i].data.fd);
}
else if (m < 0)
{
//出错
if (errno != EWOULDBLOCK && errno != EINTR)
{
if (epoll_ctl(epollfd, EPOLL_CTL_DEL, epoll_events[i].data.fd, NULL) != -1)
{
std::cout << "client disconnected,clientfd:" << epoll_events[i].data.fd << std::endl;
}
close(epoll_events[i].data.fd);
}
}
else
{
//正常收到数据
std::cout << "recv from client:" << epoll_events[i].data.fd << ", " << recvbuf << std::endl;

epoll_event client_fd_event;
client_fd_event.data.fd = epoll_events[i].data.fd;

#ifndef TEST_ET_MODE
// 水平触发模式下,需要再次给clientfd注册检测可写事件, 来接受socket上次没接收的数据
client_fd_event.events = EPOLLIN | EPOLLOUT ;
// client_fd_event.events |= EPOLLET;
if (epoll_ctl(epollfd, EPOLL_CTL_MOD, epoll_events[i].data.fd, &client_fd_event) != -1)
{
std::cout << "epoll_ctl successfully, mode: EPOLL_CTL_MOD, clientfd:" << epoll_events[i].data.fd << std::endl;
}
#endif

}
}
}
else if (epoll_events[i].events & EPOLLOUT)
{
//只处理客户端fd的可写事件
if (epoll_events[i].data.fd != listenfd)
{
// 水平触发模式下,会一直触发,打印结果
std::cout << "EPOLLOUT triggered,clientfd:" << epoll_events[i].data.fd << std::endl;
}
}
else if (epoll_events[i].events & EPOLLERR)
{
// TODO 暂不处理
}
}
}

close(listenfd);
return 0;
}

佛教中“空”的本义是什么

一切万有都是缘起,这就是佛教“空”之本义,“无”之真意。

空,是佛教对世界一切事物本质最简要的描述,是释迦世尊洞彻世界万物缘起的结论。故《心经》开头就说:“观自在菩萨,行深般若波罗蜜多时,照见五蕴皆空,度一切苦厄。舍利子,色不异空,空不异色,色即是空,空即是色,受想行识,亦复如此。”

但社会上很多人都误解了佛教的“空”字。有人反问说:“我们每天吃的、穿的、用的,以及看到的一切,难道都是空的吗?”说这话的人也许没认真思维,难道佛教徒糊涂到连日常生活都搞不清楚吗?!佛教所说的“空”,根本不是有人所认为的“没有”的意思,也与社会上常听到的“人生到头一场空”的“空”字意思有别,“一场空”的“空”字,是得不到的意思。

佛教所说的“空”,是对世间事物变化过程的描述,准确地讲,是万事万物最终要变化、要毁坏的意思,是对缘起法最本质的体证。佛教认为世上任何一种事物,都是由因缘和合而成,都是由各种条件和合而成,或其它事物变化而来,最后又变化为另外的事物

成、住、坏、空,是世上一切事物发展变化的必然,有生就有死,有成就有坏。佛教所说的空,是指事物的本性是空的,而不是指事物的外相也是空。比如我们的一辈子,父母亲生下我们时,佛法上说是四大五蕴和合而成,按科学说法,是碳、氢、氧等基本元素构成,然后长大成人,然后衰老,最后死亡,一切都是变化的,我们的一生也就是在这样的因缘变化中过去了。正是在这个意思上,我们说人生是空的,一切都是缘起性空。

所以佛法教导我们,做人不要执着于外相上的缘起缘灭,执着就苦,就起烦恼。但也不要因为认识到人生是空的,就悲观绝望,这就落入了顽空,这也是一种固执。因为“性空”并不否定相上的缘起,相是存在的,它刹那生灭变化。

一个人认识到人生的空苦,而又不落入顽空,确实需要智慧。如何获得这种智慧?这正是佛教所要解决、所能解决的。通过学佛,修戒定慧三学,体证般若的智慧,达到改变我们苦空人生的目的。

转载自,星云大师《佛学》丛书:http://www.masterhsingyun.org/article/article.jsp?index=7&item=61&bookid=2c907d4945216fae014569962c35052c&ch=4&se=1&f=1

壹‧前言

  自古以來,佛門就有「空門」之稱,因為「空」是佛教最重要的教義之一,也是佛法不共其他宗教及世間學說的特質。當初佛陀在菩提樹下、金剛座上證悟成佛,他所證悟的宇宙真理是「緣起」,緣起就是說世間一切存有的事物都是因緣所成,沒有實在的自性可言,這種諸法自性了不可得的特質就稱為「空」。因此,「空」可以說是佛教的言語中最接近諸法實相的名詞,然而一般人不了解「空」的真義,誤解佛教是消極避世的宗教。事實上,「空」蘊含無限,真空才能生妙有;「空」並不是無,而是要我們大破大立,空去一切有無對待,空去一切差別觀念,甚至連這個「空」也要空去,然後才能享有一個大解脫、大自在、空有不二的世界。

貳‧空的真義

  《中論‧觀四諦品》說:「以有空義故,一切法得成;若無空義故,一切則不成。」「空」是建立萬有的要素,以棉布為例,從緣起法來看,布是空的,因為布只是因緣和合的假相,譬如布的原料是來自棉紗,棉紗是由棉花的纖維紡成,棉花又採自棉種子,種子須要有土地、陽光、空氣、水分、肥料等的栽培灌溉,才能萌芽、成長、開花、結果,既而果熟開裂,種子密生棉毛,則可供紡紗。因此,棉布是棉籽結合了宇宙萬有的因緣而成,所以我們從「萬有的因緣」上看,它的自性就是「空」,這就是所謂的「真空能生妙有」。

  再以我們的身體為例,鼻孔不空就不能呼吸,耳朵不空就不能聽聞,乃至全身的毛孔細胞、五臟六腑如果不空,就無法生存。有了「空」,生命才能延續;心中有了「空」,才能「心包太虛,量周沙界」;世界有了「空」,才能生出宇宙萬物。所以,空是宇宙之體,是人生之本,是萬有之源。

  「空」是真理的極致,「空」能將印證真理的「三法印」統一起來,例如:

  1.世間沒有永恒性的東西。世事變化多端,這是「諸行無常」,也就是「無常苦空」。

  2.世間沒有獨存性的東西。萬物相生相成,這是「諸法無我」,也就是「緣起性空」。

  3.世間沒有實有性的東西。一切如夢幻泡影,這是「涅槃寂靜」,也就是「妙有真空」。

  「空」是一種最深刻、最奧妙的哲學,如果想用一句話來表達,事實上是不可能的。《釋摩訶衍論》中曾論「虛空十義」,雖然不能將絕對超越的「空」義淋漓盡致地描繪出來,但在人類所能理解的語言中,已經算是很接近了。所謂「虛空十義」如次:

  1.「空」有無障礙的意思,如虛空,雖遍一切處,但絕不障礙任何一色法。

  2.「空」有周遍的意思,如虛空,遍滿一切,無所不至。

  3.「空」有平等的意思,如虛空,無有簡擇,於一切平等。

  4.「空」有廣大的意思,如虛空,廣大、無垠、無際。

  5.「空」有無形相的意思,如虛空,無有形狀相貌。

  6.「空」有清淨的意思,如虛空,恒常清淨,無有垢染塵累。

  7.「空」有不動的意思,如虛空,恒常寂止,離一切生滅成壞之相。

  8.「空」有絕對否定的意思,把一切有限量的事理徹底否定、消滅。

  9.「空」有空空的意思,徹底否定一切自性和摧毀一切空執。

  10.「空」有不可得的意思,如虛空,不可取得,不可把捉。

參‧空的種類

  在佛教的經論中,有關「空」的分類很多,計有二空、三空、四空、六空、七空、十空、十一空、十六空、十八空::等等。大體而言,可歸納為人空、法空、勝義空三種。

  1.人空:又稱為我空、生空等。即有情眾生的生命,是依因緣和合而成,沒有實體可得,僅僅是假合的存在而已。

  2.法空:由有情生命出發,空義進一步擴及萬法,便有所謂的「法空」。即諸法是因緣和合而成,沒有實體的存在,所以又稱為法無我。

  3.勝義空:是將人空、法空及其他一切執著也一起空掉的「空」;是一種既不住於有,也不住於空,超越一切有無對待,而達到隨緣放曠,任運自由的境界。又稱第一義空、實相空,也就是涅槃寂靜的意思。

  《大智度論》卷三十一說:「涅槃中亦無涅槃相,涅槃空是第一義空。……能使諸法實相空,是名為第一義空。」在勝義空下,連涅槃都不住著了,世間上還有什麼不能超越的呢?

肆‧如何認識空

  在一般人的觀念裡,「空」和「有」是截然不同的兩種觀念,「有」的絕對不是「空」,「空」的絕對不是「有」。但是,佛教認為「空」和「有」是一體的兩面,諸法所以是空,是由於無自性可得;諸法所以是有,是由於相用不是空無的。

  如何才能認識「空」呢?從諸法的相用上可以認識「空」性:

  1.從相續假看空:世間沒有恒久不變的東西,一切現象只不過是相續的存在,無時無刻不在剎那生滅之中。譬如我們身體細胞的新陳代謝,不斷地進行更新;世間上的人事更替,所謂「長江後浪推前浪,一代新人換舊人」,說明了世間的事事物物是相續假有,無常而沒有實體,從這種相續無常的現象上,可以了解「有即是空」的真諦。

  2.從循環假看空:因果故空。宇宙萬物,世間諸法,都離不開因果的法則,因為果,果為因。如一粒種子,有了陽光、空氣、水分、泥土等外緣後,於是發芽、開花,乃至結果。種子是因,結成的果實是果;如果再以結成的果實接受外緣,再一次的開花結果,則原有的果,又是另一個新生命的因,因因果果,相關相涉。因此,從這個循環的假相中,可以認識空。

  3.從和合假看空:緣起故空。諸法因緣和合而生,譬如人是由皮肉、筋骨、血液等和合而成;如果把各種組織分開,人的自體無從可得。因此,從和合之中,可以瞭解空。

  4.從相對假看空:相待故空。世間萬物都是相互對待的,譬如有三層樓,一人在二樓,有人從一樓上到二樓來,二樓是「上」,一樓是「下」;三樓的人下到二樓來,此時原是「上」的二樓變成「下」,三樓才是「上」。由此可知,所謂上下的對待,是一種假相,所以是空。

  5.從相狀假看空:無標準故空。以點燈為例,蠟燭、煤油燈、電燈的亮度是沒有一定標準的,如果從蠟燭先看,認為燭光很亮,再看電燈,燭光的亮度就顯得不夠了,「亮」這個相狀是無標準的,所以從無標準的相狀上,也可知道是空。

  6.從名詞假看空:但有假名故空。宇宙間諸法萬象,各有不同的稱呼,而這些名稱都是假有,所以是空。譬如一塊布,穿在上身的叫做衣服;穿在下身的叫做褲子;穿在腳上的叫做襪子;戴在頭上的叫做帽子。同樣是一塊布,卻可以有各種不同的名稱,這些名詞原來也都是假名而已,因此是空。

  7.從認識不同看空:心境無定準故空。下雪的夜晚,詩人坐在窗前,詩興大發,歎為奇景,自語道:「若再下它三尺,景色將更綺麗。」此時,屈居於破屋簷下的乞丐,縮著身子,不勝酷寒,感歎的說:「大雪紛紛飄滿天,老天又降殺人刀,再落三尺方為景,我輩怎得到明朝?」同樣的事物,因心境的不同,就有不同的看法,由此可知,從不同的認識中,也可以了知空。

伍‧空的妙用

  《大乘密嚴經》說:「離空無有色,離色無有空,如月與光明,始終恒不異;諸法亦如是,空性與之一,展轉無差別,所為皆得成。」萬法惟其性空,才能生起宇宙萬有;萬有徒具假相,才能顯示自性本空。因此,有不是空以外的有,空也不是有以外的空,空與有是相融相即的。

  有人說:「空,是佛教的X光。」這句話實在很有道理。因為藉著X光的透視,可以讓我們看清體內的五臟六腑;同樣的,經由空性,我們便能洞悉諸法的實相。

  「空」是什麼?空就是「○」,○本身什麼都沒有,但若將○放在一的後面,則成為「一○」;若將○放在一○的後面,則成為「一○○」;放在一○○的後面,則成「一○○○」。由此可知,一個「○」,你說它沒有用,它卻能生起大作用。「空」也是如此,若說空是什麼都沒有,其實,空在宇宙世間卻能包含萬有。

  「空」是什麼?空是數學中的「X」──未知數;它能代表很多的數字。

  「空」是可以從日常生活中體驗的,例如:「女嬰」日漸長大,就稱為「女孩」;成長到十幾歲,就成為「少女」;到了二、三十歲,就稱她為「小姐」;嫁了人,又成為某某「太太」;生兒育女,就是「媽媽」;兒女婚嫁,就多了「婆婆」、「岳母」,乃至「奶奶」等等稱呼。從這些名詞的轉移上,我們認識到「空」的真諦。

  其他如前後、高低、上下、美醜、老少、大小……等等,也都是相對的概念,並沒有絕對的標準,只不過是「假名」而已。《金剛經》上說「實相非相」,又說「法無定法」。唯有「空」才是實相,才是定法。見到了「空」,我們才能如實的認識世間;瞭解了「空」,我們就能跳出有無的對待,而擁有一片更寬廣的世界。「空」真是妙用無窮!

陸‧結語

  一般人以為佛教講「空」,是要人否定一切;其實佛教的空,並不是否定一切,相反的,「空」是諸法所以成就的根據。「空」並不是頑空,是具有建設性的,譬如,沒有空間就不能建房子;袋子不空,便不能裝東西;宇宙不空,人類就無法生存,所以要「空」才能「有」。宇宙萬法就是建立在這個空義上,因為「空」並不是虛無,而是一切法之所依,是一切法不離的真性,是一切法存在與活動的原理。換句話說,如果沒有空性,一切法就不能從緣而有,也不可能有生有滅。

  所以,「空」不是消極避世的代名詞;它具有革命性與建設性的意義;當我們認識了空,就能捨棄過去舊有的執著,以嶄新的角度來審視宇宙萬有;當我們瞭解了空,就能蠲除既有的成見,從頭開始反省自己的人生。所謂「平常一樣窗前月,才有梅花便不同」,如果我們有了空的體驗,就能與宇宙萬物融為一體,「空」對於人生實在是太重要了!

…………

一、何謂空?

二、如何認識空?

三、如何從日常生活體驗空?

四、舉例說明空的妙用。

…………

  • Copyrights © 2021-2024 youngqqcn

请我喝杯咖啡吧~