I see in some source code, the author wrote a component like this:
import React from 'react';
export const Login = () => (
<div>
<h4>Hello World</h4>
</div>
);
export default Login;
The thing I don't know is:
- How react understand this is a react component by only using import
- How can I add another callback method, such as
viewDidMount... I have added in code block but it compiles fail.
thanks
Stateless Functional Componentand used when you want to create a component that doesn't have anystateorlifecycle methodsmeans purely used to return a UI. check thestackoverflow DOConStateless Functional Component: stackoverflow.com/documentation/reactjs/6588/…