score:7
it doesn't, when you do
<note />
that is just looking for a variable namednote
in the local scope. when the component is imported into another file, you can name it whatever you want. e.g.import note from './note';
would import the default-exported function in your example.this is a stateless function component, https://facebook.github.io/react/docs/reusable-components.html#stateless-functions, as you linked to yourself. the function itself is the
render
, it has no class instance.they can store no state since they just take inputs and render outputs.
your specific example is just an arrow function. the documentation linked above uses standard non-arrow functions, but they are essentially interchangable in this case. e.g.
export default () => <div>learn webpack</div>;
is the same as
export default function(){ return <div>learn webpack</div>; }
Source: stackoverflow.com
Related Query
- Please explain this abbreviated ES6 JSX declaration
- Please explain to me this weird React syntax
- How to update specific value in a array of JSON values in React, can anyone please explain this
- Can someone please explain me this code from ReactJS?
- Please explain the use of spread operator in this case
- Can someone please explain the reducer function of this reducer function header?
- Please explain this syntax of function signature in reactjs
- npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap
- forEach over es6 Map in JSX
- Can someone explain the 'super()' keyword in ES6 Javascript (especially related to React)?
- Why does jsx require three dots in this code?
- Converting jsx with ES6 import syntax using reactify
- How to unit test React JSX ES6 code with KARMA?
- How do I type this 'as' JSX attribute in TypeScript?
- { React jsx babel es6 webpack } How Can I Comment in render ( return ( // || /**/ ) )?
- Using express and es6 to render react and jsx server side
- How to fix this Jest error: "component encountered a declaration exception"?
- es6 function declaration in React class
- Cannot ES6 import JSX modules in Webpack
- React - Create tag dynamically from ES6 template literal with JSX
- Error: Should have a queue. This is likely a bug in React. Please file an issue
- What is this ES6 syntax? Colon after function call
- React component function returning JSX causes error when used in render method of ES6 class React component
- es6 jsx syntax error using "`"
- Can someone explain this to me from event loop perspective?
- react: using es6 component in ts component: ts2605: jsx element type 'yyy' is not a constructor function for jsx elements
- VSCode How do I debug with es6 mocha unit tests and jsx files
- Difference between this ES6 arrow function and regular function?
- Interpolation in React is not working this way can anybody please help me in this regards?
- Module parse failed: es6 react component with JSX inside .JS file
More Query from same tag
- Toggle between Login and Logout React component
- .map is not a function error on nextjs with firestore
- render price or owned based on 2 arrays
- Issue with .env being undefinde when using create react app --template typescript?
- React big calendar has no default export
- How to save in state few files?
- Express server doesn't start
- After Delete Mutation not Refetching Query (Apollo Graphql & Nextjs)
- Calculate Total Price in React-Redux
- In React JS, using react-select want to set options to default value after checkbox unchecked
- insert or remove enclosing element based on ternary operator JSX
- How to create a loader page for a react component that is fetching data from an api
- Update property of React component in a separate component
- Webpack-React with server-side-rendering: linking to css file in server template with hash name
- Reactjs - `component` vs `render` in Route
- Escape html in react
- Setting a (tricky) active class on react tabs
- Call contract method from React
- React router not mounting component on redirect in Chrome
- Skipping Effects does not work for Array of dynamic URL's
- React js forms / validation?
- npm ERR! cb.apply is not a function (Elementary OS)
- Problem regarding the time of downloading and creating app in react
- How to pass props to recursive child component and preserve all props
- How to get checkbox value using React
- Flask API very slow after adding route to static file
- Loading jsx file in react-component
- How do I properly get the date and time?
- How to get a value from a promise to global scope in reactjs?
- Leverage local state and avoid fetching data when data is already available?