Skip to content

sanjeetkumaritoutlook/react-local-stenciljs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Jquery to Angular to React Transition https://medium.com/hoopeez/the-deep-dive-transitioning-to-react-5917eda01ebf ost React applications are modeled on Flux design pattern). React is mostly the V in MVC. Since it is a library, you can include it in applications built using other technologies.

#Babel JSX is rewritten to JavaScript. This can be done with babel or webpack internals.

Babel is used to transpile the JavaScript code, making it compatible with older browsers, while Webpack is used to bundle and optimize the code.

resulting file is then bundled for the browser, using either webpack or browserify

Class components older version of React Functional component in new version curent version Teact v18.3 use Function components along with Hooks, which were added in React 16.8. React 19 beta has support for custom Elements

#With introduction to the React 16, writing functional components is the standard way of creating components in modern react applications. https://blog.weareredlight.com/the-rise-of-functional-components-react-v16-7-0-now-with-hooks-90cac72b8ab7?gi=27c595b1ced0

Getting Started with Create React App

This project was bootstrapped with Create React App.

Create new React App in Typescript

npx create-react-app my-app --template typescript

https://builtin.com/software-engineering-perspectives/create-react-app-typescript

create React component in typescript

https://react.dev/learn/typescript

Available Scripts

In the project directory, you can run:

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

npm test

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

npm run build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

See the section about deployment for more information.

npm run eject

Note: this is a one-way operation. Once you eject, you can’t go back!

If you aren’t satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

Learn More

You can learn more in the Create React App documentation.

To learn React, check out the React documentation.

StencilJS Web component integration localhost into React Application

https://medium.com/@sanketsatishchavan/how-to-create-web-components-for-react-using-stencil-a58b7dcd6c55

Typescript .tsx for React component

npx create-react-app my-app --template typescript https://create-react-app.dev/docs/adding-typescript/ https://react.dev/learn/typescript

React Hook "useEffect" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function react-hooks/rules-of-hooks

how to use custom Elements (web components)

in React: initialValue={'My Initial Value'}

in Angular: initial-value="My Initial Value"

In Angular, variable properties use camelCase or kebab-case [initalValue]="myVariable" should work

In Angular, use camelCase when it's a complex variable(and wrapped in [ ]) You should use kebab-case for primitive properties per the Custom Element Spec. display-stepper-buttons="false"

For simple props, you should just be able to use interpolation.

React doesn't support web components natively (yet in React v18.3), so it doesn't support camelCase for Prop names- instead React use dash-case for Primitive type Props

auto-focus={true}

for complex/reference type Props(e.g. objects,arrays,etc.), but can also be used for primitive types as well

The inline properties won't work without a ref as React doesn't support complex props on web components without them. Only primitives can be passed to web components as inline props (in React)

const inputRef = useCustomElementRef({}, {label: 'Prop Format 3 (Complex/Reference Types)', autofocus:true} );

(or) return( <fluid-form ref={useCustomElementRef({ valueChanged: (event) => handleValueChanged(event.detail) },{ config: formConfig, })}/>

FLUID React utils package, which provide wrappers around the runtime components to make it easier for React development.

in React, circled props won't work

About

local-stenciljs in react application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published